*This Stata 14 code reproduces the results reported in:
*Steiner, Nils D. and Matthias Mader. Intra-Party Heterogeneity in Policy Preferences and Its Effect on Issue Salience: Developing and Applying a Measure Based on Elite Survey Data. Party Politics.

*How to reproduce all results
*1.) Download data:
    *CCS 2016
	*Comparative Candidates Survey Module I – 2005-2013 [Dataset – cumulative file]. Distributed by FORS, Lausanne, 2016.
	*data available at http://forscenter.ch/de/daris-daten-und-forschungsinformationsservice/datenservice/spezialprojekte/comparative-candidate-survey-ccs/
	*Data set: 620_CCS_Data_Wave1_v3.1.dta
	
	*CHES 2010.
	*Bakker, Ryan, Catherine de Vries, Erica Edwards, Liesbet Hooghe, Seth Jolly, Gary Marks, Jonathan Polk, Jan Rovny, Marco Steenbergen und Milada Anna Vachudova. 2015. Measuring Party Positions in Europe: The Chapel Hill Expert Survey Trend File, 1999–2010. In: Party Politics 21: S. 143-152.
	*data available at http://chesdata.eu/
	*Data sets: 2010_CHES_dataset_means.dta.dta ; CHES_2010_expert_data_public.dta
	
	*CMP
	*Volkens, Andrea / Lehmann, Pola / Matthieß, Theres / Merz, Nicolas / Regel, Sven with Werner, Annika (2016): The Manifesto Data Collection. Manifesto Project (MRG / CMP / MARPOR). Version 2016a. Berlin: Wissenschaftszentrum Berlin für Sozialforschung (WZB).
	*data available at https://manifestoproject.wzb.eu/datasets
	*Data set: MPDataset_MPDS2016a_stata14.dta

*2.) Save all files (data sets and Stata do-files) in one folder and specify this folder as the working directory.
*3.) If neccessary, install missing ados. Ados used: agrm, estout, fre.
*4.) Execute code using Stata 14.2.

* change working directory to the folder in which you saved the data sets and do-files (if necessary)
* cd "XXX"

* change general settings (to those used for our analysis)
version 14.2
set scheme s1mono


********************************************************************************
******************* Recoding and analyis of CCS ********************************
******************************************************************************** 
*** load data set

	  use "620_CCS_Data_Wave1_v3.1.dta", clear
 
 
******************* Create country, election, party identifiers ****************
gen year=t3
gen countryID=t1

* label country identifier			
	label define countryID ///
	1 "Australia" ///
	2 "Switzerland" ///
	3 "Germany" ///
	4 "Ireland" ///
	5 "Greece" ///
	6 "Finland" ///
	7 "Belgium" ///
	8 "Netherlands" ///
	9 "Canada" ///
	10 "Portugal" ///
	11 "Estonia" ///
	12 "Iceland" ///
	13 "Hungary" ///
	14 "Austria" ///
	15 "Sweden" ///
	16 "Denmark" ///
	17 "Romania" ///
	18 "Czech Republic" ///
	19 "Norway" ///
	20 "New Zealand" ///
	21 "Italy" ///
	22 "Malta" ///
	23 "United Kingdom"
	label value countryID countryID	
		
* create unique election identifier
	gen elec_id=t1*10000+t3
* label unique election identifier identifier			
	label define elec_id ///
	12007 "Australia2007" ///
	12010 "Australia2010" ///
	22007 "Switzerland2007" ///
	22011 "Switzerland2011" ///
	32009 "Germany2009" /// 
	32005 "Germany2005" /// 
	42007 "Ireland2007" ///
	52007 "Greece2007" ///
	52009 "Greece2009" ///
	52012 "Greece2012" ///
	62007 "Finland2007" ///
	62011 "Finland2011" ///
	72007 "Belgium2007" ///
	72010 "Belgium2010" ///
	82006 "Netherlands2006" ///
	92008 "Canada2008" ///
	102009 "Portugal2009" ///
	102011 "Portugal2011" ///
	112011 "Estonia2011" ///
	122009 "Iceland2009" ///
	132010 "Hungary2010" ///
	142008 "Austria2008" ///
	152010 "Sweden2010" ///
	162011 "Denmark2011" ///
	172012 "Romania2012" ///
	182006 "CzechRepublic2006" ///
	192009 "Norway2009" ///
	202011 "NewZealand2011" ///
	212013 "Italy2013" ///
	222013 "Malta2013" ///
	232010 "UK2013"
	label value elec_id elec_id

* create unique party-election-identifier (unique ID for a particular party at a specific election): eight digits: country identifier_year_party identifier.
	gen party=a1
	gen long partyelec_id=elec_id*100+party 
	format partyelec_id  %10.00f

* drop those three surveys with next to complete missing issue batteries: Finland 2007, Canada 2008, New Zealand 2011
	drop if elec_id==62007 | elec_id==92008	| elec_id==202011
	
* combine alliances
	* CSU to CDU -> CDU/CSU
	* GER2009
	replace partyelec_id=3200902 if partyelec_id==3200903
	* GER2009
	replace partyelec_id=3200502 if partyelec_id==3200503
	
	* BEL2007: spirit to spa -> spa/spirit
	replace partyelec_id=7200713 if partyelec_id==7200714
	
	* POR2011: PCP to PEV -> CDU
	replace partyelec_id=10201103 if partyelec_id==10201104
	
	* ROM2012
	* PSD to USL -> USL
	replace partyelec_id=17201205 if partyelec_id==17201201
	* PNL to USL -> USL
	replace partyelec_id=17201205 if partyelec_id==17201202
	* PC to USL -> USL
	replace partyelec_id=17201205 if partyelec_id==10201203

* label party-election-identifier via code in separate do-file
	do "2 define party labels.do"

* create string versions of identifier variables
	* create string variable for country
	decode countryID, gen(country_string)
	* create string variable for election
	decode elec_id, gen(elec_string)
	* create string variable for partyelection
	decode partyelec_id, gen(partyelec_string)
 
 
 
 
******************* Recode issue positions *************************************
* Economic dimension
	*C2g. Providing a stable network of social security should be the prime goal of government.
	fre c2g
	gen ec1 = c2g
	
	*C2h. Income and wealth should be redistributed towards ordinary people.
	fre c2h
	gen ec2 = c2h
	
	*C2b. Politics should abstain from intervening in the economy.
	fre c2b
	recode c2b (1 = 5)(2 = 4)(3 = 3)(4 = 2)(5 = 1), gen(ec3)
    tab c2b ec3	

* Socio-cultural dimension
	*C2a. Immigrants should be required to adjust to the customs of [country].
	fre c2a
	recode c2a (1 = 5)(2 = 4)(3 = 3)(4 = 2)(5 = 1), gen(soc1)
	tab c2a soc1

	*C2f. People who break the law should be given stiffer sentences.
	fre c2f
	recode c2f (1 = 5)(2 = 4)(3 = 3)(4 = 2)(5 = 1), gen(soc2)
	tab c2f soc2

	*C2m. Torturing a prisoner is never justified even if it might prevent a terrorist attack.
	fre c2m
	gen soc3=c2m
	tab c2m soc3
		
	*C2d. Same sex marriages should be prohibited by law.
	fre c2d
	recode c2d (1 = 5)(2 = 4)(3 = 3)(4 = 2)(5 = 1), gen(soc4)
	tab c2d soc4	
	
	*C2k. Women should be free to decide on matters of abortion.
	fre c2k
	gen soc5 = c2k
	tab c2k soc5	

* European integration
	*C4. [Country's] membership of the EU good?
	fre c4
	recode c4 (1 = 2)(2 = 0)(3 = 1), gen(eu1)
	tab c4 eu1
	
	*C5. Opinion on European Unification - has already gon too far vs. should be pushed further
	fre c5
	gen eu2 = c5
	tab c5 eu2
	
	*C6. How satisfied with the way democracy works in the EU?
	fre c6
	recode c6 (1 = 3)(2 = 2)(3 = 1)(4 = 0), gen(eu3)
	tab c6 eu3	

* Environment: Stronger measures should be taken to protect the environment
	fre c2c
	gen protectenvironment = c2c
	tab c2c protectenvironment	
	
*******************  Create additive indices for economic, socio-cultural and EU dimensions **********************
	gen econ_index=((ec1+ec2+ec3)-3)/12
	gen soc_index=((soc1+soc2+soc3+soc4+soc5)-5)/20
	gen eu_index=((eu1/2)+(eu2/10)+(eu3/3))/3 			// (individual items recoded to common range)

	
*******************  Create disaggregated measures on socio-cultural dimension ************************************
* create additive index for law&order vs. civil liberties
	gen laworder_index=((soc2+soc3)-2)/8
* create additive index for social liberty vs. traditional morality
	gen soclib_index=((soc4+soc5)-2)/8
* single-item measure for multiculturalism vs. cultural adjustment 	
	gen immigrantsadjust=soc1
* single-item measure for rest	
	gen stiffersentences=soc2
	gen torturing=soc3
	gen samesexmarr=soc4
	gen abortion=soc5

	
*******************  Left-right placements *************************************
* Left-right self-placement
	fre c3
	gen leftright_ego = c3
* Left-right party placement
	fre c3a
	gen leftright_party = c3a 

	
	
	
*******************  TABLE 1B: Matrix of pairwise correlations between different issue measures *******************
* correlation matrix of all issue measures
	pwcorr ec1 ec2 ec3 soc1 soc2 soc3 soc4 soc5 eu1 eu2 eu3 econ_index soc_index eu_index protectenvironment leftright_ego
	
*******************  TABLE 1C: Factor analysis of issue items **********************************
	factor ec1 ec2 ec3 soc1 soc2 soc3 soc4 soc5 eu1 eu2 eu3, pcf
	rotate, promax blanks(0.4)
	predict f1 f2 f3 
* correlation with our additive indices
	pwcorr f1 f2 f3 econ_index soc_index eu_index
	
	

********************  FIGURES 1 and 1A  *********************************************
* compute measures of parties' mean positions and standard deviations on economic and socio-cultural dimension 
	sort partyelec_id
    by partyelec_id: egen econ_index_partymean=mean(econ_index)
	by partyelec_id: egen soc_index_partymean=mean(soc_index)
	by partyelec_id: egen econ_index_partystd=sd(econ_index)
	by partyelec_id: egen soc_index_partystd=sd(soc_index)
		
	
* write a little programm that extracts the values for the construction of the party crosses in Figures 1 and A1
* as an input it needs the partycodes in the correct order: "party1 party2 party3 ...."		
capture program drop getvaluesforcrossinFigure1
program getvaluesforcrossinFigure1
    args partycodelist 
    scalar sdmultiplier=0.5
	local i=0
	foreach party of local partycodelist {
		local i=`i'+1
		sum soc_index if partyelec_id==`party'
		scalar soc_index_p = r(mean)
		scalar soc_index_sd_p = r(sd)
		scalar soc_lower_p=soc_index_p-(sdmultiplier*soc_index_sd_p)
		scalar soc_upper_p=soc_index_p+(sdmultiplier*soc_index_sd_p)
		quietly sum econ_index if partyelec_id==`party'
		scalar econ_index_p = r(mean)
		scalar econ_index_sd_p = r(sd)
		scalar econ_lower_p=econ_index_p-(sdmultiplier*econ_index_sd_p)
		scalar econ_upper_p=econ_index_p+(sdmultiplier*econ_index_sd_p)
		display soc_index_p 	
		local y11=soc_index_p 
		local x11=econ_lower_p 
		local y12=soc_index_p 
		local x12=econ_upper_p
		local y21=soc_lower_p 
		local x21=econ_index_p 
		local y22=soc_upper_p 
		local x22=econ_index_p
		global xline_p`i' "`y11' ` ' `x11' ` ' `y12' ` ' `x12'"
		global yline_p`i' "`y21' ` ' `x21' ` ' `y22' ` ' `x22'"
	}	
end


*************************************** Figure 1 *********************************
			* set macro with jittersize
				global jittersize "2"

			* GERMANY 2009
				getvaluesforcrossinFigure1 "3200901 3200902 3200904 3200905 3200906"
				graph twoway (scatter soc_index econ_index if partyelec_id==3200901, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index if partyelec_id==3200902, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(black)) ///
				(scatter soc_index econ_index if partyelec_id==3200904, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(gold)) ///
				(scatter soc_index econ_index if partyelec_id==3200905, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(mint)) ///
				(scatter soc_index econ_index if partyelec_id==3200906, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(purple)) ///
				(scatteri $xline_p1, connect(line) lwidth(thick) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p1, connect(line) lwidth(thick) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p2, connect(line) lwidth(thick) lpattern(solid) lcolor(black) msym(none)) ///
				(scatteri $yline_p2, connect(line) lwidth(thick) lpattern(solid) lcolor(black) msym(none)) ///
				(scatteri $xline_p3, connect(line) lwidth(thick) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $yline_p3, connect(line) lwidth(thick) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $xline_p4, connect(line) lwidth(thick) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p4, connect(line) lwidth(thick) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $xline_p5, connect(line) lwidth(thick) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $yline_p5, connect(line) lwidth(thick) lpattern(solid) lcolor(purple) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Germany 2009) ///
				legend(order(1 "SPD" 2 "CDU/CSU" 3 "FDP" 4 "Grüne" 5 "Linke") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Germany2009, replace) nodraw
				
			* NETHERLANDS 2006
				getvaluesforcrossinFigure1 "8200601 8200602 8200603 8200604 8200606 8200607 8200608"
				graph twoway (scatter soc_index econ_index if partyelec_id==8200601, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(forest_green)) ///
				(scatter soc_index econ_index if partyelec_id==8200602, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index if partyelec_id==8200603, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(purple)) ///
				(scatter soc_index econ_index if partyelec_id==8200604, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(blue)) ///
				(scatter soc_index econ_index if partyelec_id==8200606, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(mint)) ///
				(scatter soc_index econ_index if partyelec_id==8200607, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(eltblue)) ///
				(scatter soc_index econ_index if partyelec_id==8200608, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(olive_teal)) ///
				(scatteri $xline_p1, connect(line) lwidth(thick) lpattern(solid) lcolor(forest_green) msym(none)) ///
				(scatteri $yline_p1, connect(line) lwidth(thick) lpattern(solid) lcolor(forest_green) msym(none)) ///
				(scatteri $xline_p2, connect(line) lwidth(thick) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p2, connect(line) lwidth(thick) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p3, connect(line) lwidth(thick) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $yline_p3, connect(line) lwidth(thick) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $xline_p4, connect(line) lwidth(thick) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $yline_p4, connect(line) lwidth(thick) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $xline_p5, connect(line) lwidth(thick) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p5, connect(line) lwidth(thick) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $xline_p6, connect(line) lwidth(thick) lpattern(solid) lcolor(eltblue) msym(none)) ///
				(scatteri $yline_p6, connect(line) lwidth(thick) lpattern(solid) lcolor(eltblue) msym(none)) ///
				(scatteri $xline_p7, connect(line) lwidth(thick) lpattern(solid) lcolor(olive_teal) msym(none)) ///
				(scatteri $yline_p7, connect(line) lwidth(thick) lpattern(solid) lcolor(olive_teal) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Netherlands 2006) ///
				legend(order(1 "CDA" 2 "PvdA" 3 "SP" 4 "VVD" 5 "GL" 6 "CU" 7 "D66") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Netherlands2006, replace) nodraw

			* SWITZERLAND 2007
				getvaluesforcrossinFigure1 "2200701 2200702 2200703 2200704 2200705"
				graph twoway (scatter soc_index econ_index if partyelec_id==2200701, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(orange)) ///
				(scatter soc_index econ_index if partyelec_id==2200702, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(midblue)) ///
				(scatter soc_index econ_index if partyelec_id==2200703, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(dkgreen)) ///
				(scatter soc_index econ_index if partyelec_id==2200704, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index if partyelec_id==2200705, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(mint)) ///
				(scatteri $xline_p1, connect(line) lwidth(thick) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $yline_p1, connect(line) lwidth(thick) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $xline_p2, connect(line) lwidth(thick) lpattern(solid) lcolor(midblue) msym(none)) ///
				(scatteri $yline_p2, connect(line) lwidth(thick) lpattern(solid) lcolor(midblue) msym(none)) ///
				(scatteri $xline_p3, connect(line) lwidth(thick) lpattern(solid) lcolor(dkgreen) msym(none)) ///
				(scatteri $yline_p3, connect(line) lwidth(thick) lpattern(solid) lcolor(dkgreen) msym(none)) ///
				(scatteri $xline_p4, connect(line) lwidth(thick) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p4, connect(line) lwidth(thick) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p5, connect(line) lwidth(thick) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p5, connect(line) lwidth(thick) lpattern(solid) lcolor(mint) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Switzerland 2007) ///
				legend(order(1 "CVP/PDC" 2 "FDP/PRD" 3 "SVP/UDC" 4 "SPS/PSS" 5 "Green") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Switzerland2007, replace) nodraw
				
			* UK 2010 
				getvaluesforcrossinFigure1 "23201001 23201002 23201003 23201004 23201008"
				graph twoway (scatter soc_index econ_index if partyelec_id==23201001, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index  if partyelec_id==23201002, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(eltblue)) ///
				(scatter soc_index econ_index  if partyelec_id==23201003, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(mint)) ///
				(scatter soc_index econ_index if partyelec_id==23201004, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(purple)) ///
				(scatter soc_index econ_index  if partyelec_id==23201008, jitter($jittersize) jitterseed(1) msize(vlarge) msymbol(x) mcolor(gold)) ///
				(scatteri $xline_p1, connect(line) lwidth(thick) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p1, connect(line) lwidth(thick) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p2, connect(line) lwidth(thick) lpattern(solid) lcolor(eltblue) msym(none)) ///
				(scatteri $yline_p2, connect(line) lwidth(thick) lpattern(solid) lcolor(eltblue) msym(none)) ///
				(scatteri $xline_p3, connect(line) lwidth(thick) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p3, connect(line) lwidth(thick) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $xline_p4, connect(line) lwidth(thick) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $yline_p4, connect(line) lwidth(thick) lpattern(solid) lcolor(purple) msym(none)) ///	
				(scatteri $xline_p5, connect(line) lwidth(thick) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $yline_p5, connect(line) lwidth(thick) lpattern(solid) lcolor(gold) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(UK 2010) ///
				legend(order(1 "Labour" 2 "Cons." 3 "Lib. Dem." 4 "UKIP" 5 "BNP") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(UK2010, replace) nodraw
	
* combine graphs
	graph combine Germany2009 Netherlands2006 Switzerland2007 UK2010, imargin(small) xcommon ycommon col(2) ysize(6.5) iscale(0.5) name(Figure1, replace)
	graph export Figure1.tif, replace width(4000)

	
	
*************************************** FIGURE 1A *********************************
			* set macro with jittersize
				global jittersize "1.2"
					
			* AUSTRALIA 2007
				getvaluesforcrossinFigure1 "1200701 1200702 1200703 1200705"
				graph twoway (scatter soc_index econ_index if partyelec_id==1200701, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(blue)) ///
				(scatter soc_index econ_index if partyelec_id==1200702, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index if partyelec_id==1200703, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(dkgreen)) ///
				(scatter soc_index econ_index if partyelec_id==1200705, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(mint)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(dkgreen) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(dkgreen) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(mint) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Australia 2007) ///
				legend(order(1 "Liberals" 2 "Labor" 3 "Nationals" 4 "Green") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Australia2007, replace) nodraw
				
			* SWITZERLAND 2007
				getvaluesforcrossinFigure1 "2200701 2200702 2200703 2200704 2200705"
				graph twoway (scatter soc_index econ_index if partyelec_id==2200701, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(orange)) ///
				(scatter soc_index econ_index if partyelec_id==2200702, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(midblue)) ///
				(scatter soc_index econ_index if partyelec_id==2200703, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(dkgreen)) ///
				(scatter soc_index econ_index if partyelec_id==2200704, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index if partyelec_id==2200705, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(mint)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(midblue) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(midblue) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(dkgreen) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(dkgreen) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p5, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p5, connect(line) lpattern(solid) lcolor(mint) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Switzerland 2007) ///
				legend(order(1 "CVP/PDC" 2 "FDP/PRD" 3 "SVP/UDC" 4 "SPS/PSS" 5 "Green") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Switzerland2007, replace) nodraw
					   
			* SWITZERLAND 2011
				getvaluesforcrossinFigure1 "2201101 2201102 2201103 2201104 2201113 2201110 2201120"
				graph twoway (scatter soc_index econ_index if partyelec_id==2201101, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(midblue)) ///
				(scatter soc_index econ_index if partyelec_id==2201102, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(orange)) ///
				(scatter soc_index econ_index if partyelec_id==2201103, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index if partyelec_id==2201104, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(dkgreen)) ///
				(scatter soc_index econ_index if partyelec_id==2201113, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(mint)) ///
				(scatter soc_index econ_index if partyelec_id==2201110, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(purple)) ///
				(scatter soc_index econ_index if partyelec_id==2201120, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(gold)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(midblue) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(midblue) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(dkgreen) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(dkgreen) msym(none)) ///
				(scatteri $xline_p5, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p5, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $xline_p6, connect(line) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $yline_p6, connect(line) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $xline_p7, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $yline_p7, connect(line) lpattern(solid) lcolor(gold) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Switzerland 2011) ///
				legend(order(1 "FDP/PRD" 2 "CVP/PDC" 3 "SP/PS" 4 "SVP/UDC" 5 "Green" 6 "GLP" 7 "BDP") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Switzerland2011, replace) nodraw

			* GERMANY 2009
				getvaluesforcrossinFigure1 "3200901 3200902 3200904 3200905 3200906"
				graph twoway (scatter soc_index econ_index if partyelec_id==3200901, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index if partyelec_id==3200902, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(black)) ///
				(scatter soc_index econ_index if partyelec_id==3200904, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(gold)) ///
				(scatter soc_index econ_index if partyelec_id==3200905, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(mint)) ///
				(scatter soc_index econ_index if partyelec_id==3200906, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(purple)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(black) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(black) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $xline_p5, connect(line) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $yline_p5, connect(line) lpattern(solid) lcolor(purple) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Germany 2009) ///
				legend(order(1 "SPD" 2 "CDU/CSU" 3 "FDP" 4 "Grüne" 5 "Linke") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Germany2009, replace) nodraw
					
			* IRELAND 2007
				getvaluesforcrossinFigure1 "4200701 4200702 4200703 4200704 4200705 4200706"
				graph twoway (scatter soc_index econ_index if partyelec_id==4200701, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(gold)) ///
				(scatter soc_index econ_index if partyelec_id==4200702, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(ltblue)) ///
				(scatter soc_index econ_index if partyelec_id==4200703, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(mint)) ///
				(scatter soc_index econ_index if partyelec_id==4200704, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index if partyelec_id==4200705, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(green)) ///
				(scatter soc_index econ_index if partyelec_id==4200706, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(blue)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(ltblue) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(ltblue) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p5, connect(line) lpattern(solid) lcolor(green) msym(none)) ///
				(scatteri $yline_p5, connect(line) lpattern(solid) lcolor(green) msym(none)) ///
				(scatteri $xline_p6, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $yline_p6, connect(line) lpattern(solid) lcolor(blue) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Ireland 2007) ///
				legend(order(1 "FF" 2 "FG" 3 "Greens" 4 "Labour" 5 "PD" 6 "SF") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Ireland2007, replace) nodraw
				
			* GREECE 2007
				getvaluesforcrossinFigure1 "5200701 5200702"
				graph twoway (scatter soc_index econ_index if partyelec_id==5200701, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(blue)) ///
				(scatter soc_index econ_index if partyelec_id==5200702, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(green)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(green) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(green) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Greece 2007) ///
				legend(order(1 "ND" 2 "PASOK") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Greece2007, replace) nodraw
					
			* GREECE 2009
				getvaluesforcrossinFigure1 "5200901 5200902"
				graph twoway (scatter soc_index econ_index if partyelec_id==5200901, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(blue)) ///
				(scatter soc_index econ_index if partyelec_id==5200902, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(green)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(green) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(green) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Greece 2009) ///
				legend(order(1 "ND" 2 "PASOK") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Greece2009, replace) nodraw
					
			* GREECE 2012
				getvaluesforcrossinFigure1 "5201201 5201202 5201203 5201206"
				graph twoway (scatter soc_index econ_index if partyelec_id==5201201, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(blue)) ///
				(scatter soc_index econ_index if partyelec_id==5201202, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(green)) ///
				(scatter soc_index econ_index if partyelec_id==5201203, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index if partyelec_id==5201206, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(purple)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(green) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(green) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(purple) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Greece 2012) ///
				legend(order(1 "ND" 2 "PASOK" 3 "Syriza" 4 "DIMAR") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Greece2012, replace) nodraw
				
			* FINLAND 2011
				getvaluesforcrossinFigure1 "6201101 6201102 6201103 6201104 6201105 6201106 6201107 6201108"
				graph twoway (scatter soc_index econ_index if partyelec_id==6201101, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(ltblue)) ///
				(scatter soc_index econ_index if partyelec_id==6201102, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index if partyelec_id==6201103, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(brown)) ///
				(scatter soc_index econ_index if partyelec_id==6201104, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(dkgreen)) ///
				(scatter soc_index econ_index if partyelec_id==6201105, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(purple)) ///
				(scatter soc_index econ_index if partyelec_id==6201106, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(mint)) ///
				(scatter soc_index econ_index if partyelec_id==6201107, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(blue)) ///
				(scatter soc_index econ_index if partyelec_id==6201108, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(gold)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(ltblue) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(ltblue) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(brown) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(brown) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(dkgreen) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(dkgreen) msym(none)) ///
				(scatteri $xline_p5, connect(line) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $yline_p5, connect(line) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $xline_p6, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p6, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $xline_p7, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $yline_p7, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $xline_p8, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $yline_p8, connect(line) lpattern(solid) lcolor(gold) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Finland 2011) ///
				legend(order(1 "Nat. Coal." 2 "Soc. Dem." 3 "Tr. Finns" 4 "Centre" 5 "Left All." 6 "Greens" 7 "Chr. Dem." 8 "Swe. Peo.") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Finland2011, replace) nodraw

			* BELGIUM 2007 - Francophone parties only
				getvaluesforcrossinFigure1 "7200701 7200702 7200703 7200704"
				graph twoway (scatter soc_index econ_index if partyelec_id==7200701, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index if partyelec_id==7200702, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(midblue)) ///
				(scatter soc_index econ_index if partyelec_id==7200703, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(gold)) ///
				(scatter soc_index econ_index if partyelec_id==7200704, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(mint)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(midblue) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(midblue) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(mint) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Belgium 2007 (Francophone)) ///
				legend(order(1 "PS" 2 "MR" 3 "CDH" 4 "Ecolo" ) rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Belgium2007Franco, replace) nodraw

			* BELGIUM 2010 - Francophone parties only
				getvaluesforcrossinFigure1 "7201001 7201002 7201003 7201004"
				graph twoway (scatter soc_index econ_index if partyelec_id==7201001, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index if partyelec_id==7201002, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(midblue)) ///
				(scatter soc_index econ_index if partyelec_id==7201003, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(gold)) ///
				(scatter soc_index econ_index if partyelec_id==7201004, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(mint)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(midblue) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(midblue) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(mint) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Belgium 2010 (Francophone)) ///
				legend(order(1 "PS" 2 "MR" 3 "CDH" 4 "Ecolo" ) rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Belgium2010Franco, replace) nodraw
				
			* BELGIUM 2007 - Dutch parties only
				getvaluesforcrossinFigure1 "7200711 7200712 7200713  7200715 7200716 7200717 7200718"
				graph twoway (scatter soc_index econ_index if partyelec_id==7200711, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(orange)) ///
				(scatter soc_index econ_index if partyelec_id==7200712, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(ltkhaki)) ///
				(scatter soc_index econ_index if partyelec_id==7200713, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(purple)) ///
				(scatter soc_index econ_index if partyelec_id==7200715, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(blue)) ///
				(scatter soc_index econ_index if partyelec_id==7200716, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(olive)) ///
				(scatter soc_index econ_index if partyelec_id==7200717, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(mint)) ///
				(scatter soc_index econ_index if partyelec_id==7200718, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(ltblue)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(ltkhaki) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(ltkhaki) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $xline_p5, connect(line) lpattern(solid) lcolor(olive) msym(none)) ///
				(scatteri $yline_p5, connect(line) lpattern(solid) lcolor(olive) msym(none)) ///
				(scatteri $xline_p6, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p6, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $xline_p7, connect(line) lpattern(solid) lcolor(ltblue) msym(none)) ///
				(scatteri $yline_p7, connect(line) lpattern(solid) lcolor(ltblue) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Belgium 2007 (Flemish)) ///
				legend(order(1 "CD&V" 2 "N-VA" 3 "sp.a/spirit" 4 "VLD" 5 "Vla. B." 6 "Groen" 7 "LDD" ) rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Belgium2007Flemish, replace) nodraw
				
			* BELGIUM 2010 - Dutch parties only
				getvaluesforcrossinFigure1 "7201011 7201012 7201013  7201015 7201016 7201017 7201018"
				graph twoway (scatter soc_index econ_index if partyelec_id==7201011, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(orange)) ///
				(scatter soc_index econ_index if partyelec_id==7201012, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(ltkhaki)) ///
				(scatter soc_index econ_index if partyelec_id==7201013, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(purple)) ///
				(scatter soc_index econ_index if partyelec_id==7201015, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(blue)) ///
				(scatter soc_index econ_index if partyelec_id==7201016, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(olive)) ///
				(scatter soc_index econ_index if partyelec_id==7201017, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(mint)) ///
				(scatter soc_index econ_index if partyelec_id==7201018, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(ltblue)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(ltkhaki) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(ltkhaki) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $xline_p5, connect(line) lpattern(solid) lcolor(olive) msym(none)) ///
				(scatteri $yline_p5, connect(line) lpattern(solid) lcolor(olive) msym(none)) ///
				(scatteri $xline_p6, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p6, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $xline_p7, connect(line) lpattern(solid) lcolor(ltblue) msym(none)) ///
				(scatteri $yline_p7, connect(line) lpattern(solid) lcolor(ltblue) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Belgium 2010 (Flemish)) ///
				legend(order(1 "CD&V" 2 "N-VA" 3 "SPA" 4 "VLD" 5 "Vla. B." 6 "Groen" 7 "LDD" ) rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Belgium2010Flemish, replace) nodraw
					
			* NETHERLANDS 2006
				getvaluesforcrossinFigure1 "8200601 8200602 8200603 8200604 8200606 8200607 8200608"
				graph twoway (scatter soc_index econ_index if partyelec_id==8200601, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(forest_green)) ///
				(scatter soc_index econ_index if partyelec_id==8200602, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index if partyelec_id==8200603, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(purple)) ///
				(scatter soc_index econ_index if partyelec_id==8200604, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(blue)) ///
				(scatter soc_index econ_index if partyelec_id==8200606, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(mint)) ///
				(scatter soc_index econ_index if partyelec_id==8200607, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(eltblue)) ///
				(scatter soc_index econ_index if partyelec_id==8200608, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(olive_teal)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(forest_green) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(forest_green) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $xline_p5, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p5, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $xline_p6, connect(line) lpattern(solid) lcolor(eltblue) msym(none)) ///
				(scatteri $yline_p6, connect(line) lpattern(solid) lcolor(eltblue) msym(none)) ///
				(scatteri $xline_p7, connect(line) lpattern(solid) lcolor(olive_teal) msym(none)) ///
				(scatteri $yline_p7, connect(line) lpattern(solid) lcolor(olive_teal) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Netherlands 2006) ///
				legend(order(1 "CDA" 2 "PvdA" 3 "SP" 4 "VVD" 5 "GL" 6 "CU" 7 "D66") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Netherlands2006, replace) nodraw
					   
			* PORTUGAL 2009
				getvaluesforcrossinFigure1 "10200901 10200902 10200903 10200904 10200905"
				graph twoway (scatter soc_index econ_index if partyelec_id==10200901, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index if partyelec_id==10200902, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(blue)) ///
				(scatter soc_index econ_index if partyelec_id==10200903, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(mint)) ///
				(scatter soc_index econ_index if partyelec_id==10200904, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(orange)) ///
				(scatter soc_index econ_index  if partyelec_id==10200905, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(erose)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $xline_p5, connect(line) lpattern(solid) lcolor(erose) msym(none)) ///
				(scatteri $yline_p5, connect(line) lpattern(solid) lcolor(erose) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Portugal 2009) ///
				legend(order(1 "BE" 2 "CDS-PP" 3 "CDU (PEV+PCP)" 4 "PSD" 5 "PS") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Portugal2009, replace) nodraw	     		
									
			* PORTUGAL 2011
				getvaluesforcrossinFigure1 "10201101 10201102 10201103 10201105 10201106"
				graph twoway (scatter soc_index econ_index if partyelec_id==10201101, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index  if partyelec_id==10201102, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(blue)) ///
				(scatter soc_index econ_index  if partyelec_id==10201103, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(mint)) ///
				(scatter soc_index econ_index  if partyelec_id==10201105, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(orange)) ///
				(scatter soc_index econ_index  if partyelec_id==10201106, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(erose)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $xline_p5, connect(line) lpattern(solid) lcolor(erose) msym(none)) ///
				(scatteri $yline_p5, connect(line) lpattern(solid) lcolor(erose) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Portugal 2011) ///
				legend(order(1 "BE" 2 "CDS-PP" 3 "CDU (PEV+PCP)" 4 "PSD" 5 "PS") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Portugal2011, replace) nodraw
					
			* ICELAND 2009
				getvaluesforcrossinFigure1 "12200901 12200902 12200903 12200904 12200906"
				graph twoway (scatter soc_index econ_index if partyelec_id==12200901, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index  if partyelec_id==12200902, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(dkgreen)) ///
				(scatter soc_index econ_index  if partyelec_id==12200903, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(blue)) ///
				(scatter soc_index econ_index if partyelec_id==12200904, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(mint)) ///
				(scatter soc_index econ_index  if partyelec_id==12200906, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(gold)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(dkgreen) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(dkgreen) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///	
				(scatteri $xline_p5, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $yline_p5, connect(line) lpattern(solid) lcolor(gold) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Iceland 2009) ///
				legend(order(1 "Soc. Dem." 2 "Progressive" 3 "Independence" 4 "Left-Green" 5 "Citizen's Mov.") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Iceland2009, replace) nodraw
					
			* SWEDEN 2010
				getvaluesforcrossinFigure1 "15201001 15201003 15201004 15201005 15201006 15201007 15201008 15201009"
				graph twoway (scatter soc_index econ_index if partyelec_id==15201001, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(black)) ///
				(scatter soc_index econ_index  if partyelec_id==15201003, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(ltblue)) ///
				(scatter soc_index econ_index if partyelec_id==15201004, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(orange)) ///
				(scatter soc_index econ_index  if partyelec_id==15201005, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(mint)) ///
				(scatter soc_index econ_index  if partyelec_id==15201006, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(blue)) ///
				(scatter soc_index econ_index  if partyelec_id==15201007, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index  if partyelec_id==15201008, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(gold)) ///
				(scatter soc_index econ_index  if partyelec_id==15201009, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(purple)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(black) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(black) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(ltblue) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(ltblue) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///	
				(scatteri $xline_p5, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $yline_p5, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $xline_p6, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p6, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p7, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $yline_p7, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $xline_p8, connect(line) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $yline_p8, connect(line) lpattern(solid) lcolor(purple) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Sweden 2010) ///
				legend(order(1 "Center" 2 "Liberal" 3 "Chr. Dem." 4 "Greens" 5 "Moder." 6 "Soc. Dem." 7 "Swe. Dem." 8 "Left Party") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Sweden2010, replace) nodraw

			* DENMARK 2011
				getvaluesforcrossinFigure1 "16201101 16201102 16201103 16201104 16201106 16201107 16201108 16201109"
				graph twoway (scatter soc_index econ_index if partyelec_id==16201101, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(mint)) ///
				(scatter soc_index econ_index if partyelec_id==16201102, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(purple)) ///
				(scatter soc_index econ_index if partyelec_id==16201103, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index if partyelec_id==16201104, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(ltblue)) ///
				(scatter soc_index econ_index if partyelec_id==16201106, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(orange)) ///
				(scatter soc_index econ_index if partyelec_id==16201107, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(blue)) ///
				(scatter soc_index econ_index if partyelec_id==16201108, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(dkgreen)) ///
				(scatter soc_index econ_index if partyelec_id==16201109, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(gold)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(ltblue) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(ltblue) msym(none)) ///	
				(scatteri $xline_p5, connect(line) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $yline_p5, connect(line) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $xline_p6, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $yline_p6, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $xline_p7, connect(line) lpattern(solid) lcolor(dkgreen) msym(none)) ///
				(scatteri $yline_p7, connect(line) lpattern(solid) lcolor(dkgreen) msym(none)) ///
				(scatteri $xline_p8, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $yline_p8, connect(line) lpattern(solid) lcolor(gold) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Denmark 2011) ///
				legend(order(1 "Red-Green" 2 "Soc." 3 "Soc. Dem." 8 "Dan. Peo." 5 "Lib. All." 7 "Cons."  4 "Soc. Lib." 6 "Venstre") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Denmark2011, replace) nodraw
					
			* NORWAY 2009
				getvaluesforcrossinFigure1 "19200901 19200902 19200903 19200904 19200905 19200906 19200907"
				graph twoway (scatter soc_index econ_index if partyelec_id==19200901, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(purple)) ///
				(scatter soc_index econ_index  if partyelec_id==19200902, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index  if partyelec_id==19200903, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(dkgreen)) ///
				(scatter soc_index econ_index if partyelec_id==19200904, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(gold)) ///
				(scatter soc_index econ_index  if partyelec_id==19200905, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(mint)) ///
				(scatter soc_index econ_index  if partyelec_id==19200906, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(ltblue)) ///
				(scatter soc_index econ_index  if partyelec_id==19200907, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(blue)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(dkgreen) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(dkgreen) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///	
				(scatteri $xline_p5, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p5, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $xline_p6, connect(line) lpattern(solid) lcolor(ltblue) msym(none)) ///
				(scatteri $yline_p6, connect(line) lpattern(solid) lcolor(ltblue) msym(none)) ///
				(scatteri $xline_p7, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $yline_p7, connect(line) lpattern(solid) lcolor(blue) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Norway 2009) ///
				legend(order(1 "Soc. Left" 2 "Labour" 3 "Centre" 4 "Chr. Dem." 5 "Liberal" 6 "Cons." 7 "Progress") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Norway2009, replace) nodraw

			* ITALY 2013
				getvaluesforcrossinFigure1 "21201303 21201304 21201305 21201306 21201308 21201309"
				graph twoway (scatter soc_index econ_index if partyelec_id==21201303, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(blue)) ///
				(scatter soc_index econ_index  if partyelec_id==21201304, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(black)) ///
				(scatter soc_index econ_index  if partyelec_id==21201305, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(gold)) ///
				(scatter soc_index econ_index if partyelec_id==21201306, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index  if partyelec_id==21201308, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(ltblue)) ///
				(scatter soc_index econ_index  if partyelec_id==21201309, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(green)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(blue) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(black) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(black) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(red) msym(none)) ///	
				(scatteri $xline_p5, connect(line) lpattern(solid) lcolor(ltblue) msym(none)) ///
				(scatteri $yline_p5, connect(line) lpattern(solid) lcolor(ltblue) msym(none)) ///
				(scatteri $xline_p6, connect(line) lpattern(solid) lcolor(green) msym(none)) ///
				(scatteri $yline_p6, connect(line) lpattern(solid) lcolor(green) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(Italy 2013) ///
				legend(order(1 "PdL" 2 "Lega Nord" 3 "M5S" 4 "PD" 5 "SC" 6 "SEL") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(Italy2013, replace) nodraw
				
			* UK 2010
				getvaluesforcrossinFigure1 "23201001 23201002 23201003 23201004 23201005 23201006 23201007 23201008"
				graph twoway (scatter soc_index econ_index if partyelec_id==23201001, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(red)) ///
				(scatter soc_index econ_index  if partyelec_id==23201002, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(eltblue)) ///
				(scatter soc_index econ_index  if partyelec_id==23201003, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(orange)) ///
				(scatter soc_index econ_index if partyelec_id==23201004, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(purple)) ///
				(scatter soc_index econ_index  if partyelec_id==23201005, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(mint)) ///
				(scatter soc_index econ_index  if partyelec_id==23201006, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(gold)) ///
				(scatter soc_index econ_index  if partyelec_id==23201005, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(dkgreen)) ///
				(scatter soc_index econ_index  if partyelec_id==23201006, jitter($jittersize) jitterseed(1) msize(small) msymbol(x) mcolor(navy)) ///
				(scatteri $xline_p1, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $yline_p1, connect(line) lpattern(solid) lcolor(red) msym(none)) ///
				(scatteri $xline_p2, connect(line) lpattern(solid) lcolor(eltblue) msym(none)) ///
				(scatteri $yline_p2, connect(line) lpattern(solid) lcolor(eltblue) msym(none)) ///
				(scatteri $xline_p3, connect(line) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $yline_p3, connect(line) lpattern(solid) lcolor(orange) msym(none)) ///
				(scatteri $xline_p4, connect(line) lpattern(solid) lcolor(purple) msym(none)) ///
				(scatteri $yline_p4, connect(line) lpattern(solid) lcolor(purple) msym(none)) ///	
				(scatteri $xline_p5, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $yline_p5, connect(line) lpattern(solid) lcolor(mint) msym(none)) ///
				(scatteri $xline_p6, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $yline_p6, connect(line) lpattern(solid) lcolor(gold) msym(none)) ///
				(scatteri $xline_p7, connect(line) lpattern(solid) lcolor(dkgreen) msym(none)) ///
				(scatteri $yline_p7, connect(line) lpattern(solid) lcolor(dkgreen) msym(none)) ///
				(scatteri $xline_p8, connect(line) lpattern(solid) lcolor(navy) msym(none)) ///
				(scatteri $yline_p8, connect(line) lpattern(solid) lcolor(navy) msym(none)), ///
				xline(0.5, lwidth(vthin)) yline(0.5, lwidth(vthin)) ///
				xscale(range(-0.01 1.01)) yscale(range(-0.01 1.01)) ///
				ylabel(, nogrid) ytitle(socio-cultural) xtitle(economic) title(UK 2010) ///
				legend(order(1 "Labour" 2 "Cons." 3 "Lib. Dem." 4 "UKIP" 5 "GPEW" 6 "SNP" 7 "Plaid Cymru" 8 "BNP") rows(2) keygap(*0.1) colgap(*0.2) rowgap(*0.5) region(lwidth(none))) ///
				name(UK2010, replace) nodraw
	
* combine graphs
	graph combine Australia2007 Belgium2007Franco Belgium2007Flemish Belgium2010Franco Belgium2010Flemish Denmark2011 Finland2011 Germany2009 Greece2007 Greece2009 Greece2012 Iceland2009 Ireland2007 Italy2013 Netherlands2006 ///
				  Norway2009 Portugal2009 Portugal2011 Sweden2010 Switzerland2007 Switzerland2011 UK2010, imargin(small) xcommon ycommon col(4) ysize(9) iscale(0.29) name(Figure1A, replace)
	graph export Figure1A.tif, replace width(4000)
	
	save "CCS_individuallevel.dta", replace

	
	
*********************** Compute the CEES VAN DER EIJK (2001) agreement measure via the agrm-ado **********
* some preparations to get ado run
	* drop cases with partyelec_id/A1=missing
	drop if partyelec_id==.
	* shorter party-election-identifier variable name
	gen long pe_id=partyelec_id
	format pe_id  %10.00f
	* Compute standard deviations for single-items
	sort partyelec_id
	by partyelec_id: egen protectenvironment_partystd=sd(protectenvironment)
	by partyelec_id: egen immigrantsadjust_partystd=sd(immigrantsadjust)
	by partyelec_id: egen stiffersentences_partystd=sd(stiffersentences)
	by partyelec_id: egen torturing_partystd=sd(torturing)
	by partyelec_id: egen samesexmarr_partystd=sd(samesexmarr)
	by partyelec_id: egen abortion_partystd=sd(abortion)
	 
	save "CCS_in_progress.dta", replace

  
* protection of the environment
	 gen environ_unst=protectenvironment
     drop if protectenvironment_partystd==.
	 bysort pe_id: agrm environ_unst, gen(A) 
	 gen A_environ=.
	 levelsof partyelec_id, local(partyelec_id)
	 foreach party_elec of local partyelec_id {
			replace A_environ=A_environ_unst_pe_id`party_elec' if A_environ_unst_pe_id`party_elec'!=.
			drop A_environ_unst_pe_id`party_elec'
	 }	
	 pwcorr A_environ protectenvironment_partystd
	 keep partyelec_id A_environ
save "A_environ.dta", replace

* immigrants should adjust
	 use "CCS_in_progress.dta", replace 
	 gen immi_unst=immigrantsadjust
     drop if immigrantsadjust_partystd==.
	 bysort pe_id: agrm immi_unst, gen(A) 
	 gen A_immi=.
	 levelsof partyelec_id, local(partyelec_id)
	 foreach party_elec of local partyelec_id {
			replace A_immi=A_immi_unst_pe_id`party_elec' if A_immi_unst_pe_id`party_elec'!=.
			drop A_immi_unst_pe_id`party_elec'
	 }	
	 pwcorr A_immi immigrantsadjust_partystd
	 keep partyelec_id A_immi
save "A_immi.dta", replace

* stiffer sentences
	 use "CCS_in_progress.dta", replace 
     gen sent=stiffersentences
	 drop if stiffersentences_partystd==.
	 bysort pe_id: agrm sent, gen(A) 
	 gen A_sent=.
	 levelsof partyelec_id, local(partyelec_id)
	 foreach party_elec of local partyelec_id {
			replace A_sent=A_sent_pe_id`party_elec' if A_sent_pe_id`party_elec'!=.
			drop A_sent_pe_id`party_elec'
	 }	
	 pwcorr A_sent stiffersentences_partystd
	 keep partyelec_id A_sent
save "A_sent.dta", replace

* torturing
	 use "CCS_in_progress.dta", replace 
     gen tort=torturing
	 drop if torturing_partystd==.
	 bysort pe_id: agrm tort, gen(A) 
	 gen A_tort=.
	 levelsof partyelec_id, local(partyelec_id)
	 foreach party_elec of local partyelec_id {
			replace A_tort=A_tort_pe_id`party_elec' if A_tort_pe_id`party_elec'!=.
			drop A_tort_pe_id`party_elec'
	 }	
	 pwcorr A_tort torturing_partystd
	 keep partyelec_id A_tort
save "A_tort.dta", replace

* Same sex marriage
	 use "CCS_in_progress.dta", replace 
     gen samesex=samesexmarr
	 drop if samesexmarr_partystd==.
	 bysort pe_id: agrm samesex, gen(A) 
	 gen A_samesex=.
	 levelsof partyelec_id, local(partyelec_id)
	 foreach party_elec of local partyelec_id {
			replace A_samesex=A_samesex_pe_id`party_elec' if A_samesex_pe_id`party_elec'!=.
			drop A_samesex_pe_id`party_elec'
	 }	
	 pwcorr A_samesex samesexmarr_partystd
	 keep partyelec_id A_samesex
save "A_samesex.dta", replace

* abortion
use "CCS_in_progress.dta", replace 
     gen abort=abortion
	 drop if abortion_partystd==.
	 bysort pe_id: agrm abort, gen(A) 
	 gen A_abort=.
	 levelsof partyelec_id, local(partyelec_id)
	 foreach party_elec of local partyelec_id {
			replace A_abort=A_abort_pe_id`party_elec' if A_abort_pe_id`party_elec'!=.
			drop A_abort_pe_id`party_elec'
	 }	
	 pwcorr A_abort abortion_partystd
	 keep partyelec_id A_abort
save "A_abort.dta", replace



* merge data on agreement
use "CCS_in_progress.dta", replace 
merge m:m partyelec_id using "A_environ.dta", generate(A_environ_merge)
merge m:m partyelec_id using "A_immi.dta", generate(A_immi_merge)
merge m:m partyelec_id using "A_sent.dta", generate(A_sent_merge)
merge m:m partyelec_id using "A_tort.dta", generate(A_tort_merge)
merge m:m partyelec_id using "A_samesex.dta", generate(A_samesex_merge)
merge m:m partyelec_id using "A_abort.dta", generate(A_abort_merge)


* Change sign of van der Eijk's agreement measure such that it measures disagreement
gen disA_environ=-A_environ
gen disA_immi=-A_immi
gen disA_sent=-A_sent
gen disA_tort=-A_tort
gen disA_samesex=-A_samesex
gen disA_abort=-A_abort
	
	
	
********************************************************************************
************ Collapse the dataset to party_election structure ******************
******************************************************************************** 
* get mean positions, standard deviations and count of valid observations
	collapse (mean) econ_mean=econ_index soc_mean=soc_index eu_index_mean=eu_index protectenvironment_mean=protectenvironment ///
					immigrantsadjust_mean=immigrantsadjust laworder_index_mean=laworder_index soclib_index_mean=soclib_index  ///
					leftright_ego_mean=leftright_ego leftright_party_mean=leftright_party ///
					disA_environ disA_immi ///
					disA_sent disA_tort disA_samesex disA_abort ///
					stiffersentences torturing samesexmarr abortion ///
					year countryID elec_id ///
					///
			  (sd)  econ_sd=econ_index soc_sd=soc_index eu_sd=eu_index protectenvironment_sd=protectenvironment  ///
					immigrantsadjust_sd=immigrantsadjust laworder_index_sd=laworder_index soclib_index_sd=soclib_index ///
					leftright_ego_sd=leftright_ego leftright_party_sd=leftright_party ///
					///
			(count) N_econ=econ_index N_soc=soc_index N_eu=eu_index N_protectenvironment=protectenvironment ///
					N_immigrantsadjust=immigrantsadjust N_laworder=laworder_index N_soclib_index=soclib_index ///
					N_stiffersentences=stiffersentences N_torturing=torturing N_samesexmarr=samesexmarr N_abortion=abortion ///
					N_leftright_ego=leftright_ego N_leftright_party=leftright_party ///
					, by (partyelec_id)

* label country and election identifier in collapsed data set
	label value countryID countryID	
	label value elec_id elec_id
	decode countryID, gen(country_string)

	
	
	
********************************************************************************
********************* Merge with Manifesto and CHES 2010  **********************
******************************************************************************** 

******************* Manifesto  *********************	
* create Manifesto party code
	do "3 create Manifesto codes.do"
	label define Manifesto_code .a "party not included"
	label value party_id_Manifesto Manifesto_code
* save dataset
	save "collapsed party data.dta", replace
* open Manifesto data
	use "MPDataset_MPDS2016a_stata14.dta", clear
	rename party party_id_Manifesto
* Manage electoral alliance: create new entries for CDU (Portuguese one); combine data for PEV + PCP
	* copy observations for PCP	
	expand 2 if date==201106 & party_id_Manifesto==35220
	expand 2 if date==200909 & party_id_Manifesto==35220
	* change partycode and partyname of copied observations
	replace party_id_Manifesto = 999999 in 3925
	replace party_id_Manifesto = 999999 in 3926
	replace partyname = "CDU: PCP Portuguese Communist Party + PEV: Ecologist Party 'The Greens'" in 3925
	replace partyname = "CDU: PCP Portuguese Communist Party + PEV: Ecologist Party 'The Greens'" in 3926
	* change variable values to missing
	foreach varname of varlist parfam-intpeace {
	replace `varname'=. if party_id_Manifesto==999999
	}
	* create a weight 
	* weight for the PCP
	gen weight_CDU=4 if party_id_Manifesto==35220
	* weight for the PEV
	replace weight_CDU=1 if party_id_Manifesto==35110
	* enter weighted means
	* 2009
	foreach varname of varlist total-intpeace {
	summarize `varname' [w=weight_CDU] if date==200909 & (party_id_Manifesto==35110 | party_id_Manifesto==35220)
	replace `varname'=r(mean) if party_id_Manifesto==999999 & date==200909
	}
	* 2011
	foreach varname of varlist total-intpeace {
	summarize `varname' [w=weight_CDU] if date==201106 & (party_id_Manifesto==35110 | party_id_Manifesto==35220)
	replace `varname'=r(mean) if party_id_Manifesto==999999 & date==201106
	}
* Some reorganisation of the Manifesto data
	gen year=year(edate)
	sort party_id_Manifesto year
	* generate lagged values
	by party_id_Manifesto: gen pervote_lag1=pervote[_n-1]
	by party_id_Manifesto: gen absseat_lag1= absseat[_n-1]
	by party_id_Manifesto: gen totseat_lag1= totseat[_n-1]
	gen percseat_lag1=absseat_lag1/totseat_lag1
	* generate lead values
	foreach varname of varlist total-year {
	by party_id_Manifesto: gen `varname'_lead1=`varname'[_n+1]
	}
	* drop Greece 2012 election in May 2012 (CCS data for Greece 2012 belongs to June 2012 election; prevent duplicate)
	drop if country==34 & date==201205
* save reorganised Manifesto dataset
	save "MPDataset_MPDS2016a_merge.dta", replace
* reopen collapsed CCS data
	use "collapsed party data.dta", clear
* merge with Manifesto
	merge m:m party_id_Manifesto year using "MPDataset_MPDS2016a_merge.dta", generate(Manifesto_merge)
* drop cases that are Manifesto only
	drop if Manifesto_merge==2


******************* CHES 2010  *********************	
* create CHES2010 party code
	do "4 create CHES2010 codes.do"
	label define CHES2010_code .a "party not included" .b "country not included in CHES2010"
	label value party_id_CHES2010 CHES2010_code
* save dataset
	save "collapsed party data.dta", replace
	
* open CHES2010 data, using the MEAN data in a first step
	use "2010_CHES_dataset_means.dta", clear
* some reorganisation of the CHES2010 data
	rename party_id party_id_CHES2010
	sort party_id_CHES2010
* Manage electoral alliance: create new entry for CDU/CSU; combine data for CDU + CSU - weighted mean
	* copy observations for PCP	
	expand 2 if party_id_CHES==301
	* change partycode and partyname of copied observations
	set obs 240
	replace party_id_CHES = 999999 in 240
	replace party_name = "CDU/CSU" in 240
	* change variable values to missing
	foreach varname of varlist position-eu_good_gov {
	replace `varname'=. if party_id_CHES==999999
	}
	* create a weight 
	gen weight_Union=4 if party_id_CHES==301 // CDU
	replace weight_Union=1 if party_id_CHES==308 // CSU
	* enter weighted means
	foreach varname of varlist position-eu_good_gov {
	summarize `varname' [w=weight_Union] if party_id_CHES==301 | party_id_CHES==308
	replace `varname'=r(mean) if party_id_CHES==999999
	}		
* save reorganised CHES2010 party-level dataset
	save "2010_CHES_dataset_means_merge.dta", replace
	
* open EXPERT level data of CHES2010
	use "CHES_2010_expert_data_public.dta", clear
* Collapse to party level and get standard deviations of relevant positions
	collapse (sd) econlr_CHES2010_sd=econlr galtan_CHES2010_sd=galtan eu_pos_CHES2010_sd=eu_pos multiculturalism_CHES2010_sd=immigrant_asylum environment_CHES2010_sd=environment ///
				  civlib_laworder_CHES2010_sd=civlib_laworder social_salience_CHES2010_sd=social_salience, by (party_id) 
	rename party_id party_id_CHES2010
	sort party_id_CHES2010
* create combined entry for CDU/CSU - weighted means
	set obs 240
	replace party_id_CHES2010 = 999999 in 240
	* create a weight 
	gen weight_Union=1 if party_id_CHES==301
	replace weight_Union=0.25 if party_id_CHES==308
	* enter weighted means
	foreach varname of varlist econlr_CHES2010_sd-eu_pos_CHES2010_sd {
	summarize `varname' [w=weight_Union] if party_id_CHES==301 | party_id_CHES==308
	replace `varname'=r(mean) if party_id_CHES==999999
	}
* save reorganised CHES2010 expert-level dataset
	save "2010_CHES_dataset_expertscollapsed_merge.dta", replace

* reopen collapsed CCS data
	use "collapsed party data.dta", clear
* merge with CHES 2010 party-level dataset
	merge m:m party_id_CHES2010 using "2010_CHES_dataset_means_merge.dta", generate(CHES2010_merge)
* drop cases that are CHES2010 only
	drop if CHES2010_merge==2
* merge with CHES 2010 collapsed expert-level dataset
	merge m:m party_id_CHES2010 using "2010_CHES_dataset_expertscollapsed_merge.dta", generate(CHES2010collexpert_merge)
* drop cases that are CHES2010 expert-level only
	drop if CHES2010collexpert_merge==2
	
	
* Drop all cases with missing Manifesto and CHES 2010 matches
	drop if CHES2010_merge==1 & Manifesto_merge==1	
* save final merged dataset
	sort partyelec_id
	save "collapsed party data merged with CSES and CMP.dta", replace

	
	
	
	use "collapsed party data merged with CSES and CMP.dta", clear

	
* set minimum number of valide candidate positions for party to be included in analyis below (before standardization)
	global minN 10		

	
	
********************************************************************************
********************* Create salience measures and compare them ****************
********************************************************************************

************ Create salience measures ******************************************
* CHES data
	* Basic issues
	gen econ_salience_CHES2010=(spendvtax_salience+dereg_salience+redist_salience)/3
	gen soc_salience_CHES2010=(civlib_salience+social_salience+relig_salience+immigra_salience+immasylum_salience)/5   
		
	
* Manifesto data 
* t
	* Basic issues
	egen econ_salience_Manifesto=rowtotal(per401 per402 per403 per404 per406 per407 per409 per412 per413 per503 per504 per505 per701 per702) if per401<.
	egen soc_salience_Manifesto=rowtotal(per601-per608 per705 per706 per2022 per2023 per6072 per6081 per7051 per7052) if per601<.
	egen eu_salience_Manifesto=rowtotal(per108 per110) if per108<. 
	gen eu_salience_Manifesto_log=ln(eu_salience_Manifesto+1)
	egen enviro_salience_Manifesto=rowtotal(per501) if per501<. 
	gen enviro_salience_Manifesto_log=ln(enviro_salience_Manifesto+1)
	
	* Disaggregated measures socio-cultural dimension
	egen multicult_salience_Manifesto=rowtotal(per607 per608) if per607<. // per607: multiculturalism + ; per608: multiculturalism - 
	gen multicult_salience_Manifesto_log=ln(multicult_salience_Manifesto+1)
	egen ordervslib_salience_Manifesto=rowtotal(per201 per605) if per201<. // per 201: freedom & human rights; per201: law and order + 
	gen ordervslib_salience_Manif_log=ln(ordervslib_salience_Manifesto+1)
	egen soclib_salience_Manifesto=rowtotal(per603 per604) if per603<. // per 603/604: traditional morality: positive/negative 
	gen soclib_salience_Manif_log=ln(soclib_salience_Manifesto+1)

* t+1
	* Basic issues
	egen econ_salience_Manifesto_lead1=rowtotal(per401_lead1 per402_lead1 per403_lead1 per404_lead1 per406_lead1 per407_lead1 per409_lead1 ///
										per412_lead1 per413_lead1 per503_lead1 per504_lead1 per505_lead1 per701_lead1 per702_lead1) if per401_lead1<.
	egen soc_salience_Manifesto_lead1=rowtotal(per601_lead1-per608_lead1 per705_lead1 per706_lead1 per2022_lead1 per2023_lead1 per6072_lead1 ///
										per6081_lead1 per7051_lead1 per7052_lead1) if per601_lead<.
	egen eu_salience_Manif_lead1=rowtotal(per108_lead1 per110_lead1) if per108_lead1<.
	gen eu_salience_Manif_lead1_log=ln(eu_salience_Manif_lead1+1)
	egen enviro_salience_Manifesto_lead1=rowtotal(per501_lead1) if per501_lead1<.
	gen enviro_salience_Manif_lead1_log=ln(enviro_salience_Manifesto_lead1+1)
	
	* Disaggregated measures socio-cultural dimension
	egen multicult_salience_Manif_lead1=rowtotal(per607_lead1 per608_lead1) if per607_lead1<.
	gen multicult_salience_Man_lead1_log=ln(multicult_salience_Manif_lead1+1)
	egen ordervslib_salience_Manif_lead1=rowtotal(per201_lead1 per605_lead1) if per201_lead1<.
	gen ordervslib_sal_Man_lead1_log=ln(ordervslib_salience_Manif_lead1+1)
	egen soclib_salience_Manif_lead1=rowtotal(per603_lead1 per604_lead1) if per603_lead1<.
	gen soclib_salience_Man_lead1_log=ln(soclib_salience_Manif_lead1+1)



************ Compare salience measures  *****************************************
* Basic issues (-> used for TABLE 1E, last column)
	pwcorr econ_salience_Manifesto econ_salience_CHES2010 if N_econ>=$minN, sig obs
	pwcorr soc_salience_Manifesto soc_salience_CHES2010 if N_soc>=$minN, sig obs
	pwcorr eu_salience_Manifesto_log eu_salience if N_eu>=$minN, sig obs
	pwcorr enviro_salience_Manifesto_log enviro_salience if N_protectenvironment>=$minN, sig obs

* Disaggregated measures socio-cultural dimension (-> used for TABLE 1O, fourth column)
	pwcorr multicult_salience_Manifesto_log immasylum_salience if N_immigrantsadjust>=$minN, sig obs
	pwcorr ordervslib_salience_Manifesto civlib_salience if N_laworder>=$minN, sig obs
	pwcorr soclib_salience_Manif_log social_salience if N_soclib_index>=$minN, sig obs
	

	

		
	
********************************************************************************
************************ Standardization to range from 0 to 1 ******************
********************************************************************************
		
************ Heterogeneity measures ********************************************
* Basic issues
	sum econ_sd if N_econ>=$minN
	replace econ_sd=(econ_sd-r(min))/(r(max)-r(min)) if N_econ>=$minN
	sum soc_sd if N_soc>=$minN
	replace soc_sd=(soc_sd-r(min))/(r(max)-r(min)) if N_soc>=$minN
	sum eu_sd if N_eu>=$minN
	replace eu_sd=(eu_sd-r(min))/(r(max)-r(min)) if N_eu>=$minN
	sum disA_environ if N_protectenvironment>=$minN
	replace disA_environ=(disA_environ-r(min))/(r(max)-r(min)) if N_protectenvironment>=$minN

* Disaggregated measures socio-cultural dimension
	sum disA_immi if N_immigrantsadjust>=$minN
	replace disA_immi=(disA_immi-r(min))/(r(max)-r(min)) if N_immigrantsadjust>=$minN
	sum laworder_index_sd if N_laworder>=$minN
	replace laworder_index_sd=(laworder_index_sd-r(min))/(r(max)-r(min)) if N_laworder>=$minN
	sum soclib_index_sd if N_soclib_index>=$minN
	replace soclib_index_sd=(soclib_index_sd-r(min))/(r(max)-r(min)) if N_soclib_index>=$minN
	
	
	sum disA_sent if N_stiffersentences>=$minN
	replace disA_sent=(disA_sent-r(min))/(r(max)-r(min)) if N_stiffersentences>=$minN
	sum disA_tort if N_torturing>=$minN
	replace disA_tort=(disA_tort-r(min))/(r(max)-r(min)) if N_torturing>=$minN
	sum disA_samesex if N_samesexmarr>=$minN
	replace disA_samesex=(disA_samesex-r(min))/(r(max)-r(min)) if N_samesexmarr>=$minN
	sum disA_abort if N_abortion>=$minN
	replace disA_abort=(disA_abort-r(min))/(r(max)-r(min)) if N_abortion>=$minN


************ Salience measures *************************************************
* CHES 2010
	* Basic issues
	sum econ_salience_CHES2010 if N_econ>=$minN
	replace econ_salience_CHES2010=(econ_salience_CHES2010-r(min))/(r(max)-r(min)) if N_econ>=$minN
	sum soc_salience_CHES2010 if N_soc>=$minN
	replace soc_salience_CHES2010=(soc_salience_CHES2010-r(min))/(r(max)-r(min)) if N_soc>=$minN
	sum eu_salience if N_eu>=$minN
	replace eu_salience=(eu_salience-r(min))/(r(max)-r(min)) if N_eu>=$minN
	sum enviro_salience if N_protectenvironment>=$minN
	replace enviro_salience=(enviro_salience-r(min))/(r(max)-r(min)) if N_protectenvironment>=$minN

	* Disaggregated measures socio-cultural dimension
	sum immasylum_salience if N_immigrantsadjust>=$minN
	replace immasylum_salience=(immasylum_salience-r(min))/(r(max)-r(min)) if N_immigrantsadjust>=$minN
	sum civlib_salience if N_laworder>=$minN
	replace civlib_salience=(civlib_salience-r(min))/(r(max)-r(min)) if N_laworder>=$minN
	sum social_salience if N_soclib_index>=$minN
	replace social_salience=(social_salience-r(min))/(r(max)-r(min)) if N_soclib_index>=$minN
		
* Manifesto data 
* t
	* Basic issues
	sum econ_salience_Manifesto if N_econ>=$minN
	replace econ_salience_Manifesto=(econ_salience_Manifesto-r(min))/(r(max)-r(min)) if N_econ>=$minN
	sum soc_salience_Manifesto if N_soc>=$minN
	replace soc_salience_Manifesto=(soc_salience_Manifesto-r(min))/(r(max)-r(min)) if N_soc>=$minN
	sum eu_salience_Manifesto_log if N_eu>=$minN
	replace eu_salience_Manifesto_log=(eu_salience_Manifesto_log-r(min))/(r(max)-r(min)) if N_eu>=$minN
	sum enviro_salience_Manifesto_log if N_protectenvironment>=$minN
	replace enviro_salience_Manifesto_log=(enviro_salience_Manifesto_log-r(min))/(r(max)-r(min)) if N_protectenvironment>=$minN
	
	* Disaggregated measures socio-cultural dimension
	sum multicult_salience_Manifesto_log if N_immigrantsadjust>=$minN
	replace multicult_salience_Manifesto_log=(multicult_salience_Manifesto_log-r(min))/(r(max)-r(min)) if N_immigrantsadjust>=$minN
	sum ordervslib_salience_Manifesto if N_laworder>=$minN
	replace ordervslib_salience_Manifesto=(ordervslib_salience_Manifesto-r(min))/(r(max)-r(min)) if N_laworder>=$minN
	sum soclib_salience_Manif_log if N_soclib_index>=$minN
	replace soclib_salience_Manif_log=(soclib_salience_Manif_log-r(min))/(r(max)-r(min)) if N_soclib_index>=$minN

* t+1
	* Basic issues
	sum econ_salience_Manifesto_lead1 if N_econ>=$minN
	replace econ_salience_Manifesto_lead1=(econ_salience_Manifesto_lead1-r(min))/(r(max)-r(min)) if N_econ>=$minN
	sum soc_salience_Manifesto_lead1 if N_soc>=$minN
	replace soc_salience_Manifesto_lead1=(soc_salience_Manifesto_lead1-r(min))/(r(max)-r(min)) if N_soc>=$minN
	sum eu_salience_Manif_lead1_log if N_eu>=$minN
	replace eu_salience_Manif_lead1_log=(eu_salience_Manif_lead1_log-r(min))/(r(max)-r(min)) if N_eu>=$minN
	sum enviro_salience_Manif_lead1_log if N_protectenvironment>=$minN
	replace enviro_salience_Manif_lead1_log=(enviro_salience_Manif_lead1_log-r(min))/(r(max)-r(min)) if N_protectenvironment>=$minN

	* Disaggregated measures socio-cultural dimension
	sum multicult_salience_Man_lead1_log if N_immigrantsadjust>=$minN
	replace multicult_salience_Man_lead1_log=(multicult_salience_Man_lead1_log-r(min))/(r(max)-r(min)) if N_immigrantsadjust>=$minN
	sum ordervslib_salience_Manif_lead1 if N_laworder>=$minN
	replace ordervslib_salience_Manif_lead1=(ordervslib_salience_Manif_lead1-r(min))/(r(max)-r(min)) if N_laworder>=$minN
	sum soclib_salience_Man_lead1_log if N_soclib_index>=$minN
	replace soclib_salience_Man_lead1_log=(soclib_salience_Man_lead1_log-r(min))/(r(max)-r(min)) if N_soclib_index>=$minN
	
	
	
	
	
	
	
********************************************************************************
********************* Check for construct validity *****************************
********************************************************************************

****** Compare standard deviations with van der Eijk's (dis-)agreement measure (for single item measures only)***
pwcorr disA_environ protectenvironment_sd if N_protectenvironment>=$minN
pwcorr disA_immi immigrantsadjust_sd if N_immigrantsadjust>=$minN



********************* Comparing party (mean) positions *************************
********************* TABLE 1 *************************
* Positions against CHES 2010: Basic measures
	pwcorr lrecon econ_mean if N_econ>=$minN, sig obs
	pwcorr galtan soc_mean if N_soc>=$minN, sig obs
	pwcorr position eu_index_mean if N_eu>=$minN, sig obs
	pwcorr environment protectenvironment_mean if N_protectenvironment>=$minN, sig obs

********************* Table 1O, last column *************************
* Positions against CHES 2010: Disaggregated measures socio-cultural dimension
	pwcorr multiculturalism immigrantsadjust_mean if N_immigrantsadjust>=$minN, sig obs
	pwcorr civlib_laworder laworder_index_mean if N_laworder>=$minN, sig obs
	pwcorr sociallifestyle soclib_index_mean if N_soclib>=$minN, sig obs



********************* EU heterogeneity and EU conflict *************************
* correlation  between EU heterogeneity and EU conflict as measured by CHES 2010
	corr eu_dissent eu_sd if N_eu>=$minN
	

* TABLE 1F and FIGURE 1B: Predicting EU conflict from EU heterogeneity and EU salience and their interaction 
	xtreg eu_dissent eu_sd eu_salience if N_eu>=$minN, re i(elec_id)
	quietly eststo t1F_m1	
	xtreg eu_dissent c.eu_sd##c.eu_salience if N_eu>=$minN, re i(elec_id) 
	quietly eststo t1F_m2
	margins, dydx(eu_sd) at(eu_salience=(0 0.1 0.2 0.3 0.4 0.5 0.6 0.7  0.8 0.9 1))
	marginsplot, yline(0) ///
			 title("Average marginal effects of candidate preference heterogeneity", size(medium) margin(medium)) ///
			 xtitle("EU salience") ytitle("") ///
			 name(Figure1B_1, replace) nodraw
	margins, dydx(eu_salience) at(eu_sd=(0 0.1 0.2 0.3 0.4 0.5 0.6 0.7  0.8 0.9 1))
	marginsplot, yline(0) ///
			 title("Average marginal effects of EU salience", size(medium) margin(medium)) ///
			 xtitle("Preference heterogeneity") ytitle("") ///
			 name(Figure1B_2, replace) nodraw
	esttab t1F_m1 t1F_m2 using Table1F.rtf, b(a2) se(a2) star(+ 0.10 * 0.05 ** 0.01 *** 0.001) varwidth(20) nogaps compress ///
	nonumbers replace
	graph combine Figure1B_1 Figure1B_2, ycommon xsize(7) title("Conditional average marginal effects on conflict over EU integration")
	graph export Figure1B.tif, replace width(4000)

	
	
	
********************************************************************************
********************************************************************************
************************ Heterogeneity -> salience *****************************
********************************************************************************
********************************************************************************
	
	
	
********************************************************************************
************************ Scatterplots: FIGURE 2 ********************************
********************************************************************************
* economic
	pwcorr econ_salience_Manifesto econ_sd if N_econ>=$minN, sig obs
	twoway (scatter econ_salience_Manifesto econ_sd, ytitle(Salience of economic dim.) ///
			xtitle(Heterogeneity on economic dimension) xscale(lcolor(none))) ///
			(lfit econ_salience_Manifesto econ_sd, legend(off) text(0.95 0.85 "r=-0.24**")) if N_econ>=$minN, name(SDandSal_Manifesto_econ, replace) 
	pwcorr econ_salience_CHES2010 econ_sd if N_econ>=$minN, sig obs
	twoway (scatter econ_salience_CHES2010 econ_sd, ytitle(Salience of economic dim.) ///
			xtitle(Heterogeneity on economic dimension) xscale(lcolor(none)))  ///
			(lfit econ_salience_CHES2010 econ_sd, legend(off) text(0.95 0.85 "r=-0.37***")) if N_econ>=$minN, name(SDandSal_CHES_econ, replace) 
* socio-cultural
	pwcorr soc_salience_Manifesto soc_sd if N_soc>=$minN, sig obs
	twoway (scatter soc_salience_Manifesto soc_sd, ytitle(Salience of socio-cultural dim.) ///
			xtitle(Heterogeneity on socio-cultural dimension) xscale(lcolor(none))) ///
			(lfit soc_salience_Manifesto soc_sd, legend(off) text(0.95 0.85 "r=-0.20*")) if N_soc>=$minN, name(SDandSal_Manifesto_soc, replace) 
	pwcorr soc_salience_CHES2010 soc_sd if N_soc>=$minN, sig obs
	twoway (scatter soc_salience_CHES2010 soc_sd, ytitle(Salience of socio-cultural dim.) ///
			xtitle(Heterogeneity on socio-cultural dimension) xscale(lcolor(none)))  ///
			(lfit soc_salience_CHES2010 soc_sd, legend(off) text(0.95 0.85 "r=-0.11")) if N_soc>=$minN, name(SDandSal_CHES_soc, replace) 	
* eu
	pwcorr eu_salience_Manifesto_log eu_sd if N_eu>=$minN, sig obs 
	twoway (scatter eu_salience_Manifesto_log eu_sd, ytitle(Salience of EU dim.) ///
			xtitle(Heterogeneity on EU dimension) xscale(lcolor(none)))  ///
			(lfit eu_salience_Manifesto_log eu_sd, legend(off) text(0.95 0.85 "r=-0.29**")) if N_eu>=$minN, name(SDandSal_Manifesto_eu, replace) 
	pwcorr eu_salience eu_sd if N_eu>$minN, sig obs
	twoway (scatter eu_salience eu_sd, ytitle(Salience of EU dim.) ///
			xtitle(Heterogeneity on EU dimension) xscale(lcolor(none)))  ///
			(lfit eu_salience eu_sd, legend(off) text(0.95 0.85 "r=-0.43***")) if N_eu>=$minN, name(SDandSal_CHES_eu, replace) 	
* environment
	pwcorr enviro_salience_Manifesto_log disA_environ if N_protectenvironment>=$minN, sig obs
	twoway (scatter enviro_salience_Manifesto_log disA_environ, ytitle(Salience of environment dim.) ///
			xtitle(Heterogeneity on environment dimension) xscale(lcolor(none)))  ///
			(lfit enviro_salience_Manifesto_log disA_environ, legend(off) text(0.95 0.85 "r=-0.48***")) if N_protectenvironment>=$minN, name(SDandSal_Manifesto_enviro, replace) 
	pwcorr enviro_salience  disA_environ if N_protectenvironment>=$minN, sig obs
	twoway (scatter enviro_salience disA_environ, ytitle(Salience of environment dim.) ///
			xtitle(Heterogeneity on environment dimension) xscale(lcolor(none)))  ///
			(lfit enviro_salience disA_environ, legend(off) text(0.95 0.85 "r=-0.62***")) if N_protectenvironment>=$minN, name(SDandSal_CHES_enviro, replace) 	

* combine graphs for Manifesto 
	graph combine SDandSal_Manifesto_econ SDandSal_Manifesto_soc SDandSal_Manifesto_eu SDandSal_Manifesto_enviro  ///
			, xcommon ycommon iscale(0.5) title("Heterogeneity of candidate positions (CCS) and issue salience (Manifesto)", size(medsmall)) name(SDandSal_Manifesto, replace)
* combine graphs for CHES 
	graph combine SDandSal_CHES_econ SDandSal_CHES_soc SDandSal_CHES_eu SDandSal_CHES_enviro  ///
			, xcommon ycommon iscale(0.5) title("Heterogeneity of candidate positions (CCS) and issue salience (CHES 2010)", size(medsmall)) name(SDandSal_CHES, replace)
* combine both graphs
	graph combine SDandSal_CHES SDandSal_Manifesto, rows(2) ysize(8)
	graph export Figure2.tif, replace width(2000)
	
	
	

***********************************************************************************************************
*************************************** Control ***********************************************************
***********************************************************************************************************
* EXTREMITY of positions: absolute distance from theoretical mid point of scale as measured by CHES 2010

* Basic issues
	gen lrecon_CHES_dev=abs(lrecon-5)
	gen galtan_CHES_dev=abs(galtan-5)
	gen eu_CHES_dev=abs(position-4)
	gen environment_dev=abs(environment-5)

* Disaggregated measures socio-cultural dimension
	gen multiculturalism_dev=abs(multiculturalism-5)
	gen civlib_laworder_dev=abs(civlib_laworder-5)
	gen sociallifestyle_dev=abs(sociallifestyle-5)




********************************************************************************
************************ REGRESSION ANALYSIS ***********************************
********************************************************************************

* TABLE 2: Fixed effect models
	xtreg econ_salience_Manifesto econ_sd lrecon_CHES_dev if N_econ>=$minN, fe i(elec_id)
	quietly eststo t2_m1
	xtreg econ_salience_CHES2010 econ_sd lrecon_CHES_dev if N_econ>=$minN, fe i(elec_id) 
	quietly eststo t2_m2
	xtreg soc_salience_Manifesto soc_sd galtan_CHES_dev if N_soc>=$minN, fe i(elec_id)
	quietly eststo t2_m3
	xtreg soc_salience_CHES2010 soc_sd galtan_CHES_dev if N_soc>=$minN, fe i(elec_id)
	quietly eststo t2_m4
	xtreg eu_salience_Manifesto_log eu_sd eu_CHES_dev if N_eu>=$minN, fe i(elec_id)
	quietly eststo t2_m5
	xtreg eu_salience eu_sd eu_CHES_dev if N_eu>=$minN, fe i(elec_id) 
	quietly eststo t2_m6
	xtreg enviro_salience_Manifesto_log disA_environ environment_dev if N_protectenvironment>=$minN, fe i(elec_id)
	quietly eststo t2_m7
	xtreg enviro_salience disA_environ environment_dev if N_protectenvironment>=$minN, fe i(elec_id)
	quietly eststo t2_m8
	esttab t2_m1 t2_m2 t2_m3 t2_m4 t2_m5 t2_m6 t2_m7 t2_m8 using Table2.rtf, b(a2) se(a2) star(* 0.05 ** 0.01 *** 0.001) varwidth(20) nogaps compress ///
	mtitles("Economic" "Economic" "Socio-cultural" "Socio-cultural" "EU" "EU" "Environment" "Environment") nonumbers replace


* TABLE 1G: Random effect models
	xtreg econ_salience_Manifesto econ_sd lrecon_CHES_dev if N_econ>=$minN, re i(elec_id)
	quietly eststo t1G_m1
	xtreg econ_salience_CHES2010 econ_sd lrecon_CHES_dev if N_econ>=$minN, re i(elec_id) 
	quietly eststo t1G_m2
	xtreg soc_salience_Manifesto soc_sd galtan_CHES_dev if N_soc>=$minN, re i(elec_id)
	quietly eststo t1G_m3
	xtreg soc_salience_CHES2010 soc_sd galtan_CHES_dev if N_soc>=$minN, re i(elec_id)
	quietly eststo t1G_m4
	xtreg eu_salience_Manifesto_log eu_sd eu_CHES_dev if N_eu>=$minN, re i(elec_id)
	quietly eststo t1G_m5
	xtreg eu_salience eu_sd eu_CHES_dev if N_eu>=$minN, re i(elec_id) 
	quietly eststo t1G_m6
	xtreg enviro_salience_Manifesto_log disA_environ environment_dev if N_protectenvironment>=$minN, re i(elec_id)
	quietly eststo t1G_m7
	xtreg enviro_salience disA_environ environment_dev if N_protectenvironment>=$minN, re i(elec_id)
	quietly eststo t1G_m8
	esttab t1G_m1 t1G_m2 t1G_m3 t1G_m4 t1G_m5 t1G_m6 t1G_m7 t1G_m8 using Table1G.rtf, b(a2) se(a2) star(* 0.05 ** 0.01 *** 0.001) varwidth(20) nogaps compress ///
	mtitles("Economic" "Economic" "Socio-cultural" "Socio-cultural" "EU" "EU" "Environment" "Environment") nonumbers replace


* TABLE 1H: Manifesto t+1
	xtreg econ_salience_Manifesto_lead1 econ_sd lrecon_CHES_dev if N_econ>=$minN, i(elec_id)
	quietly eststo t1H_m1
	xtreg econ_salience_Manifesto_lead1 econ_sd lrecon_CHES_dev if N_econ>=$minN, fe i(elec_id)
	quietly eststo t1H_m2
	xtreg soc_salience_Manifesto_lead1 soc_sd galtan_CHES_dev if N_soc>=$minN, i(elec_id)
	quietly eststo t1H_m3
	xtreg soc_salience_Manifesto_lead1 soc_sd galtan_CHES_dev if N_soc>=$minN, fe i(elec_id)
	quietly eststo t1H_m4
	xtreg eu_salience_Manif_lead1_log eu_sd eu_CHES_dev if N_eu>=$minN, i(elec_id)
	quietly eststo t1H_m5
	xtreg eu_salience_Manif_lead1_log eu_sd eu_CHES_dev if N_eu>=$minN, fe i(elec_id)
	quietly eststo t1H_m6
	xtreg enviro_salience_Manif_lead1_log disA_environ environment_dev if N_protectenvironment>=$minN, i(elec_id)
	quietly eststo t1H_m7
	xtreg enviro_salience_Manif_lead1_log disA_environ environment_dev if N_protectenvironment>=$minN, fe i(elec_id)
	quietly eststo t1H_m8
	esttab t1H_m1 t1H_m2 t1H_m3 t1H_m4 t1H_m5 t1H_m6 t1H_m7 t1H_m8 using Table1H.rtf, b(a2) se(a2) star(* 0.05 ** 0.01 *** 0.001) varwidth(20) nogaps compress ///
	mtitles("Economic" "Economic" "Socio-cultural" "Socio-cultural" "EU" "EU" "Environment" "Environment" "Multiculturalism" "Multiculturalism") nonumbers replace


	save "collapsed party data merged with CSES and CMP.dta", replace
		
	
* TABLE 1I: Fixed effect models with all parties for which at least 2 valid candidate oservations on the issue are available
	global minN 2	
		
						********************************************************************************
						************************ New Standardization  **********************************
						********************************************************************************
								
						************ Heterogeneity measures ********************************************
						* Basic issues
							sum econ_sd if N_econ>=$minN
							replace econ_sd=(econ_sd-r(min))/(r(max)-r(min)) if N_econ>=$minN
							sum soc_sd if N_soc>=$minN
							replace soc_sd=(soc_sd-r(min))/(r(max)-r(min)) if N_soc>=$minN
							sum eu_sd if N_eu>=$minN
							replace eu_sd=(eu_sd-r(min))/(r(max)-r(min)) if N_eu>=$minN
							sum disA_environ if N_protectenvironment>=$minN
							replace disA_environ=(disA_environ-r(min))/(r(max)-r(min)) if N_protectenvironment>=$minN

						* Disaggregated measures socio-cultural dimension
							sum disA_immi if N_immigrantsadjust>=$minN
							replace disA_immi=(disA_immi-r(min))/(r(max)-r(min)) if N_immigrantsadjust>=$minN
							sum laworder_index_sd if N_laworder>=$minN
							replace laworder_index_sd=(laworder_index_sd-r(min))/(r(max)-r(min)) if N_laworder>=$minN
							sum soclib_index_sd if N_soclib_index>=$minN
							replace soclib_index_sd=(soclib_index_sd-r(min))/(r(max)-r(min)) if N_soclib_index>=$minN


						************ Salience measures *************************************************
						* CHES 2010
							* Basic issues
							sum econ_salience_CHES2010 if N_econ>=$minN
							replace econ_salience_CHES2010=(econ_salience_CHES2010-r(min))/(r(max)-r(min)) if N_econ>=$minN
							sum soc_salience_CHES2010 if N_soc>=$minN
							replace soc_salience_CHES2010=(soc_salience_CHES2010-r(min))/(r(max)-r(min)) if N_soc>=$minN
							sum eu_salience if N_eu>=$minN
							replace eu_salience=(eu_salience-r(min))/(r(max)-r(min)) if N_eu>=$minN
							sum enviro_salience if N_protectenvironment>=$minN
							replace enviro_salience=(enviro_salience-r(min))/(r(max)-r(min)) if N_protectenvironment>=$minN

							* Disaggregated measures socio-cultural dimension
							sum immasylum_salience if N_immigrantsadjust>=$minN
							replace immasylum_salience=(immasylum_salience-r(min))/(r(max)-r(min)) if N_immigrantsadjust>=$minN
							sum civlib_salience if N_laworder>=$minN
							replace civlib_salience=(civlib_salience-r(min))/(r(max)-r(min)) if N_laworder>=$minN
							sum social_salience if N_soclib_index>=$minN
							replace social_salience=(social_salience-r(min))/(r(max)-r(min)) if N_soclib_index>=$minN
								
						* Manifesto data 
						* t
							* Basic issues
							sum econ_salience_Manifesto if N_econ>=$minN
							replace econ_salience_Manifesto=(econ_salience_Manifesto-r(min))/(r(max)-r(min)) if N_econ>=$minN
							sum soc_salience_Manifesto if N_soc>=$minN
							replace soc_salience_Manifesto=(soc_salience_Manifesto-r(min))/(r(max)-r(min)) if N_soc>=$minN
							sum eu_salience_Manifesto_log if N_eu>=$minN
							replace eu_salience_Manifesto_log=(eu_salience_Manifesto_log-r(min))/(r(max)-r(min)) if N_eu>=$minN
							sum enviro_salience_Manifesto_log if N_protectenvironment>=$minN
							replace enviro_salience_Manifesto_log=(enviro_salience_Manifesto_log-r(min))/(r(max)-r(min)) if N_protectenvironment>=$minN	
						
						
						
	xtreg econ_salience_Manifesto econ_sd lrecon_CHES_dev if N_econ>=$minN, fe i(elec_id)
	quietly eststo t1I_m1
	xtreg econ_salience_CHES2010 econ_sd lrecon_CHES_dev if N_econ>=$minN, fe i(elec_id) 
	quietly eststo t1I_m2
	xtreg soc_salience_Manifesto soc_sd galtan_CHES_dev if N_soc>=$minN, fe i(elec_id)
	quietly eststo t1I_m3
	xtreg soc_salience_CHES2010 soc_sd galtan_CHES_dev if N_soc>=$minN, fe i(elec_id)
	quietly eststo t1I_m4
	xtreg eu_salience_Manifesto_log eu_sd eu_CHES_dev if N_eu>=$minN, fe i(elec_id)
	quietly eststo t1I_m5
	xtreg eu_salience eu_sd eu_CHES_dev if N_eu>=$minN, fe i(elec_id) 
	quietly eststo t1I_m6
	xtreg enviro_salience_Manifesto_log disA_environ environment_dev if N_protectenvironment>=$minN, fe i(elec_id)
	quietly eststo t1I_m7
	xtreg enviro_salience disA_environ environment_dev if N_protectenvironment>=$minN, fe i(elec_id)
	quietly eststo t1I_m8
	esttab t1I_m1 t1I_m2 t1I_m3 t1I_m4 t1I_m5 t1I_m6 t1I_m7 t1I_m8 using Table1I.rtf, b(a2) se(a2) star(* 0.05 ** 0.01 *** 0.001) varwidth(20) nogaps compress ///
	mtitles("Economic" "Economic" "Socio-cultural" "Socio-cultural" "EU" "EU" "Environment" "Environment") nonumbers replace


* TABLE 1J. Fixed effect models with all parties for which at least 30 valid candidate oservations on the issue are available
	global minN 30	
		
						********************************************************************************
						************************ New Standardization  **********************************
						********************************************************************************
								
						************ Heterogeneity measures ********************************************
						* Basic issues
							sum econ_sd if N_econ>=$minN
							replace econ_sd=(econ_sd-r(min))/(r(max)-r(min)) if N_econ>=$minN
							sum soc_sd if N_soc>=$minN
							replace soc_sd=(soc_sd-r(min))/(r(max)-r(min)) if N_soc>=$minN
							sum eu_sd if N_eu>=$minN
							replace eu_sd=(eu_sd-r(min))/(r(max)-r(min)) if N_eu>=$minN
							sum disA_environ if N_protectenvironment>=$minN
							replace disA_environ=(disA_environ-r(min))/(r(max)-r(min)) if N_protectenvironment>=$minN

						* Disaggregated measures socio-cultural dimension
							sum disA_immi if N_immigrantsadjust>=$minN
							replace disA_immi=(disA_immi-r(min))/(r(max)-r(min)) if N_immigrantsadjust>=$minN
							sum laworder_index_sd if N_laworder>=$minN
							replace laworder_index_sd=(laworder_index_sd-r(min))/(r(max)-r(min)) if N_laworder>=$minN
							sum soclib_index_sd if N_soclib_index>=$minN
							replace soclib_index_sd=(soclib_index_sd-r(min))/(r(max)-r(min)) if N_soclib_index>=$minN


						************ Salience measures *************************************************
						* CHES 2010
							* Basic issues
							sum econ_salience_CHES2010 if N_econ>=$minN
							replace econ_salience_CHES2010=(econ_salience_CHES2010-r(min))/(r(max)-r(min)) if N_econ>=$minN
							sum soc_salience_CHES2010 if N_soc>=$minN
							replace soc_salience_CHES2010=(soc_salience_CHES2010-r(min))/(r(max)-r(min)) if N_soc>=$minN
							sum eu_salience if N_eu>=$minN
							replace eu_salience=(eu_salience-r(min))/(r(max)-r(min)) if N_eu>=$minN
							sum enviro_salience if N_protectenvironment>=$minN
							replace enviro_salience=(enviro_salience-r(min))/(r(max)-r(min)) if N_protectenvironment>=$minN

							* Disaggregated measures socio-cultural dimension
							sum immasylum_salience if N_immigrantsadjust>=$minN
							replace immasylum_salience=(immasylum_salience-r(min))/(r(max)-r(min)) if N_immigrantsadjust>=$minN
							sum civlib_salience if N_laworder>=$minN
							replace civlib_salience=(civlib_salience-r(min))/(r(max)-r(min)) if N_laworder>=$minN
							sum social_salience if N_soclib_index>=$minN
							replace social_salience=(social_salience-r(min))/(r(max)-r(min)) if N_soclib_index>=$minN
								
						* Manifesto data 
						* t
							* Basic issues
							sum econ_salience_Manifesto if N_econ>=$minN
							replace econ_salience_Manifesto=(econ_salience_Manifesto-r(min))/(r(max)-r(min)) if N_econ>=$minN
							sum soc_salience_Manifesto if N_soc>=$minN
							replace soc_salience_Manifesto=(soc_salience_Manifesto-r(min))/(r(max)-r(min)) if N_soc>=$minN
							sum eu_salience_Manifesto_log if N_eu>=$minN
							replace eu_salience_Manifesto_log=(eu_salience_Manifesto_log-r(min))/(r(max)-r(min)) if N_eu>=$minN
							sum enviro_salience_Manifesto_log if N_protectenvironment>=$minN
							replace enviro_salience_Manifesto_log=(enviro_salience_Manifesto_log-r(min))/(r(max)-r(min)) if N_protectenvironment>=$minN	
							
	xtreg econ_salience_Manifesto econ_sd lrecon_CHES_dev if N_econ>=$minN, fe i(elec_id)
	quietly eststo t1J_m1
	xtreg econ_salience_CHES2010 econ_sd lrecon_CHES_dev if N_econ>=$minN, fe i(elec_id) 
	quietly eststo t1J_m2
	xtreg soc_salience_Manifesto soc_sd galtan_CHES_dev if N_soc>=$minN, fe i(elec_id)
	quietly eststo t1J_m3
	xtreg soc_salience_CHES2010 soc_sd galtan_CHES_dev if N_soc>=$minN, fe i(elec_id)
	quietly eststo t1J_m4
	xtreg eu_salience_Manifesto_log eu_sd eu_CHES_dev if N_eu>=$minN, fe i(elec_id)
	quietly eststo t1J_m5
	xtreg eu_salience eu_sd eu_CHES_dev if N_eu>=$minN, fe i(elec_id) 
	quietly eststo t1J_m6
	xtreg enviro_salience_Manifesto_log disA_environ environment_dev if N_protectenvironment>=$minN, fe i(elec_id)
	quietly eststo t1J_m7
	xtreg enviro_salience disA_environ environment_dev if N_protectenvironment>=$minN, fe i(elec_id)
	quietly eststo t1J_m8
	esttab t1J_m1 t1J_m2 t1J_m3 t1J_m4 t1J_m5 t1J_m6 t1J_m7 t1J_m8 using Table1J.rtf, b(a2) se(a2) star(* 0.05 ** 0.01 *** 0.001) varwidth(20) nogaps compress ///
	mtitles("Economic" "Economic" "Socio-cultural" "Socio-cultural" "EU" "EU" "Environment" "Environment") nonumbers replace


* TABLE 1N: Disaggregating the socio-cultural dimension
	use "collapsed party data merged with CSES and CMP.dta", replace
		
	global minN 10	

	xtreg multicult_salience_Manifesto_log immigrantsadjust_sd multiculturalism_dev if N_immigrantsadjust>=$minN, fe i(elec_id)
	quietly eststo t1N_m1
	xtreg immasylum_salience immigrantsadjust_sd multiculturalism_dev if N_immigrantsadjust>=$minN, fe i(elec_id) 
	quietly eststo t1N_m2

	xtreg ordervslib_salience_Manifesto disA_sent civlib_laworder_dev if N_laworder>=$minN, fe i(elec_id)
	quietly eststo t1N_m3
	xtreg civlib_salience disA_sent civlib_laworder_dev if N_laworder>=$minN, fe i(elec_id)
	quietly eststo t1N_m4

	xtreg ordervslib_salience_Manifesto disA_tort civlib_laworder_dev if N_laworder>=$minN, fe i(elec_id)
	quietly eststo t1N_m5
	xtreg civlib_salience disA_tort civlib_laworder_dev if N_laworder>=$minN, fe i(elec_id)
	quietly eststo t1N_m6
	
	xtreg soclib_salience_Manif_log disA_samesex sociallifestyle_dev if N_soclib_index>=$minN, fe i(elec_id)
	quietly eststo t1N_m7
	xtreg  social_salience disA_samesex sociallifestyle_dev if N_soclib_index>=$minN, fe i(elec_id) 
	quietly eststo t1N_m8
	
	xtreg soclib_salience_Manif_log disA_abort sociallifestyle_dev if N_soclib_index>=$minN, fe i(elec_id)
	quietly eststo t1N_m9
	xtreg  social_salience disA_abort sociallifestyle_dev if N_soclib_index>=$minN, fe i(elec_id) 
	quietly eststo t1N_m10
	
	esttab t1N_m1 t1N_m2 t1N_m3 t1N_m4 t1N_m5 t1N_m6 t1N_m7 t1N_m8 t1N_m9 t1N_m10 using Table1N.rtf, b(a2) se(a2) star(* 0.05 ** 0.01 *** 0.001) varwidth(20) nogaps compress ///
	mtitles("Multicult." "Multicult." "Stiffer sentences" "Stiffer sentences" "Torture" "Torture" "Same-sex marriage" "Same-sex marriage" "Abortion" "Abortion") nonumbers replace

	
	
	sum immigrantsadjust_mean if N_immigrantsadjust>=10, detail
	sum stiffersentences if N_stiffersentences>=10, detail
	sum torturing if N_torturing>=10, detail
	sum samesexmarr if N_samesexmarr>=10, detail
	sum abortion if N_abortion>=10, detail

	
* TABLE 1K: Use only surveys with response rates higher than a third
	use "collapsed party data merged with CSES and CMP.dta", replace
	* mark election-cases with response rates higher than 33%
	gen response_high=1 if elec_id==12007 | elec_id==12010 | elec_id==22007 | elec_id==22011 | elec_id==32005 | elec_id==42007 | elec_id==52007 | elec_id==62011 | ///
							elec_id==72007 | elec_id==72011 | elec_id==82006 | elec_id==122009 | elec_id==152010 | elec_id==162011 | elec_id==192009 | elec_id==232010 
	xtreg econ_salience_Manifesto econ_sd lrecon_CHES_dev if N_econ>=$minN & response_high==1, fe i(elec_id)
	quietly eststo t1K_m1
	xtreg econ_salience_CHES2010 econ_sd lrecon_CHES_dev if N_econ>=$minN & response_high==1, fe i(elec_id) 
	quietly eststo t1K_m2
	xtreg soc_salience_Manifesto soc_sd galtan_CHES_dev if N_soc>=$minN & response_high==1, fe i(elec_id)
	quietly eststo t1K_m3
	xtreg soc_salience_CHES2010 soc_sd galtan_CHES_dev if N_soc>=$minN & response_high==1, fe i(elec_id)
	quietly eststo t1K_m4
	xtreg eu_salience_Manifesto_log eu_sd eu_CHES_dev if N_eu>=$minN & response_high==1, fe i(elec_id)
	quietly eststo t1K_m5
	xtreg eu_salience eu_sd eu_CHES_dev if N_eu>=$minN & response_high==1, fe i(elec_id) 
	quietly eststo t1K_m6
	xtreg enviro_salience_Manifesto_log disA_environ environment_dev if N_protectenvironment>=$minN & response_high==1, fe i(elec_id)
	quietly eststo t1K_m7
	xtreg enviro_salience disA_environ environment_dev if N_protectenvironment>=$minN & response_high==1, fe i(elec_id)
	quietly eststo t1K_m8
	esttab t1K_m1 t1K_m2 t1K_m3 t1K_m4 t1K_m5 t1K_m6 t1K_m7 t1K_m8 using Table1K.rtf, b(a2) se(a2) star(* 0.05 ** 0.01 *** 0.001) varwidth(20) nogaps compress ///
	mtitles("Economic" "Economic" "Socio-cultural" "Socio-cultural" "EU" "EU" "Environment" "Environment") nonumbers replace
		
		
	
	
********************************************************************************
**************************** Raw Data: TABLE 1D ********************************
********************************************************************************
	global minN 10	
* enter missing values if number of observations is below ten
	replace econ_sd=. if N_econ<$minN
	replace soc_sd=. if N_soc<$minN
	replace eu_sd=. if N_eu<$minN
	replace disA_environ=. if N_protectenvironment<$minN

	replace econ_mean=. if N_econ<$minN
	replace soc_mean=. if N_soc<$minN
	replace eu_index_mean=. if N_eu<$minN
	replace protectenvironment_mean=. if N_protectenvironment<$minN
* drop observations with missing values on all measures of interest
	drop if econ_sd==. & soc_sd==. & eu_sd==. & disA_environ==.  ///
			& econ_mean==. & soc_mean==. & eu_index_mean==. & protectenvironment_mean==. 
	sort country_string year partyelec_id 
	order country_string year partyelec_id econ_sd soc_sd eu_sd disA_environ  ///	
										   econ_mean soc_mean eu_index_mean protectenvironment_mean 
* now copied from data editor 




	


******************************************************************************************
******************************** TABLE 1L ************************************************
*** Repeat stuff using only candidates that thought they had some chance to win **********
******************************************************************************************
use "CCS_individuallevel.dta", replace
fre b16
bysort elec_id: fre b16
keep if b16==2 | b16==3 | b16==4 | b16==5 


						*********************** Compute the CEES VAN DER EIJK (2001) agreement measure via the agrm-ado **********
						* some preparations to get ado run
							* drop cases with partyelec_id/A1=missing
							drop if partyelec_id==.
							* shorter party-election-identifier variable name
							gen long pe_id=partyelec_id
							format pe_id  %10.00f
							* Compute standard deviations for single-items
							bysort partyelec_id: egen protectenvironment_partystd=sd(protectenvironment)
							by partyelec_id: egen immigrantsadjust_partystd=sd(immigrantsadjust)
						 
							save "CCS_in_progress.dta", replace

						  
						* protection of the environment
							 gen environ_unst=protectenvironment
							 drop if protectenvironment_partystd==.
							 bysort pe_id: agrm environ_unst, gen(A) 
							 gen A_environ=.
							 levelsof partyelec_id, local(partyelec_id)
							 foreach party_elec of local partyelec_id {
									replace A_environ=A_environ_unst_pe_id`party_elec' if A_environ_unst_pe_id`party_elec'!=.
									drop A_environ_unst_pe_id`party_elec'
							 }	
							 pwcorr A_environ protectenvironment_partystd
							 keep partyelec_id A_environ
						save "A_environ.dta", replace

						* immigrants should adjust
							 use "CCS_in_progress.dta", replace 
							 gen immi_unst=immigrantsadjust
							 drop if immigrantsadjust_partystd==.
							 bysort pe_id: agrm immi_unst, gen(A) 
							 gen A_immi=.
							 levelsof partyelec_id, local(partyelec_id)
							 foreach party_elec of local partyelec_id {
									replace A_immi=A_immi_unst_pe_id`party_elec' if A_immi_unst_pe_id`party_elec'!=.
									drop A_immi_unst_pe_id`party_elec'
							 }	
							 pwcorr A_immi immigrantsadjust_partystd
							  keep partyelec_id A_immi
						save "A_immi.dta", replace

						* merge data on agreement
						use "CCS_in_progress.dta", replace 
						merge m:m partyelec_id using "A_environ.dta", generate(A_environ_merge)
						merge m:m partyelec_id using "A_immi.dta", generate(A_immi_merge)

						* Change sign of van der Eijk's agreement measure such that it measures disgreement
						gen disA_environ=-A_environ
						gen disA_immi=-A_immi
							
							
							
						********************************************************************************
						************ Collapse the dataset to party_election structure ******************
						******************************************************************************** 
						* get mean positions, standard deviations and count of valid observations
							collapse (mean) econ_mean=econ_index soc_mean=soc_index eu_index_mean=eu_index protectenvironment_mean=protectenvironment ///
											immigrantsadjust_mean=immigrantsadjust laworder_index_mean=laworder_index soclib_index_mean=soclib_index  ///
											leftright_ego_mean=leftright_ego leftright_party_mean=leftright_party ///
											disA_environ disA_immi ///
											year countryID elec_id ///
											///
									  (sd)  econ_sd=econ_index soc_sd=soc_index eu_sd=eu_index protectenvironment_sd=protectenvironment  ///
											immigrantsadjust_sd=immigrantsadjust laworder_index_sd=laworder_index soclib_index_sd=soclib_index ///
											leftright_ego_sd=leftright_ego leftright_party_sd=leftright_party ///
											///
									(count) N_econ=econ_index N_soc=soc_index N_eu=eu_index N_protectenvironment=protectenvironment ///
											N_immigrantsadjust=immigrantsadjust N_laworder=laworder_index N_soclib_index=soclib_index ///
											N_leftright_ego=leftright_ego N_leftright_party=leftright_party ///
											, by (partyelec_id)

						* label country and election identifier in collapsed data set
							label value countryID countryID	
							label value elec_id elec_id
							decode countryID, gen(country_string)

							
							
							
						********************************************************************************
						********************* Merge with Manifesto and CHES 2010  **********************
						******************************************************************************** 

						******************* Manifesto  *********************	
						* create Manifesto party code
							do "3 create Manifesto codes.do"
							label define Manifesto_code .a "party not included"
							label value party_id_Manifesto Manifesto_code
						* merge with Manifesto
							merge m:m party_id_Manifesto year using "MPDataset_MPDS2016a_merge.dta", generate(Manifesto_merge)
						* drop cases that are Manifesto only
							drop if Manifesto_merge==2


						******************* CHES 2010  *********************	
						* create CHES2010 party code
							do "4 create CHES2010 codes.do"
							label define CHES2010_code .a "party not included" .b "country not included in CHES2010"
							label value party_id_CHES2010 CHES2010_code
						* merge with CHES 2010 party-level dataset
							merge m:m party_id_CHES2010 using "2010_CHES_dataset_means_merge.dta", generate(CHES2010_merge)
						* drop cases that are CHES2010 only
							drop if CHES2010_merge==2
						* merge with CHES 2010 collapsed expert-level dataset
							merge m:m party_id_CHES2010 using "2010_CHES_dataset_expertscollapsed_merge.dta", generate(CHES2010collexpert_merge)
						* drop cases that are CHES2010 expert-level only
							drop if CHES2010collexpert_merge==2
						* Drop all cases with missing Manifesto and CHES 2010 matches
							drop if CHES2010_merge==1 & Manifesto_merge==1	

							
							sort partyelec_id
							
							
						********************************************************************************
						********************* Create salience measures and compare them ****************
						********************************************************************************

						************ Create salience measures ******************************************
						* CHES data
							* Basic issues
							gen econ_salience_CHES2010=(spendvtax_salience+dereg_salience+redist_salience)/3
							gen soc_salience_CHES2010=(civlib_salience+social_salience+relig_salience+immigra_salience+immasylum_salience)/5     // Note: This tries to match our index; as we do not include environment, environment is not included in the salience index for example
								
							
						* Manifesto data 
						* t
							* Basic issues
							egen econ_salience_Manifesto=rowtotal(per401 per402 per403 per404 per406 per407 per409 per412 per413 per503 per504 per505 per701 per702) if per401<.
							egen soc_salience_Manifesto=rowtotal(per601-per608 per705 per706 per2022 per2023 per6072 per6081 per7051 per7052) if per601<.
							egen eu_salience_Manifesto=rowtotal(per108 per110) if per108<. 
							gen eu_salience_Manifesto_log=ln(eu_salience_Manifesto+1)
							egen enviro_salience_Manifesto=rowtotal(per501) if per501<. 
							gen enviro_salience_Manifesto_log=ln(enviro_salience_Manifesto+1)
							
							* Disaggregated measures socio-cultural dimension
							egen multicult_salience_Manifesto=rowtotal(per607 per608) if per607<. // per607: multiculturalism + ; per608: multiculturalism - (s. auch items zu national way of life)
							gen multicult_salience_Manifesto_log=ln(multicult_salience_Manifesto+1)
							egen ordervslib_salience_Manifesto=rowtotal(per201 per605) if per201<. // per 201: freedom & human rights; per201: law and order + 
															/// per 201 doesn't really fit well (see description); problem is: there is no good indicator for the other side of the scale 
							gen ordervslib_salience_Manif_log=ln(ordervslib_salience_Manifesto+1)
							egen soclib_salience_Manifesto=rowtotal(per603 per604) if per603<. // per 603/604: traditional morality: positive/negative 
							gen soclib_salience_Manif_log=ln(soclib_salience_Manifesto+1)

							
							
						********************************************************************************
						************************ Standardization to range from 0 to 1 ******************
						********************************************************************************
						* set minimum number of valide candidate positions for party to be included in analyis below (before standardization)
							global minN 10	
								
						************ Heterogeneity measures ********************************************
						* Basic issues
							sum econ_sd if N_econ>=$minN
							replace econ_sd=(econ_sd-r(min))/(r(max)-r(min)) if N_econ>=$minN
							sum soc_sd if N_soc>=$minN
							replace soc_sd=(soc_sd-r(min))/(r(max)-r(min)) if N_soc>=$minN
							sum eu_sd if N_eu>=$minN
							replace eu_sd=(eu_sd-r(min))/(r(max)-r(min)) if N_eu>=$minN
							sum disA_environ if N_protectenvironment>=$minN
							replace disA_environ=(disA_environ-r(min))/(r(max)-r(min)) if N_protectenvironment>=$minN

						* Disaggregated measures socio-cultural dimension
							sum disA_immi if N_immigrantsadjust>=$minN
							replace disA_immi=(disA_immi-r(min))/(r(max)-r(min)) if N_immigrantsadjust>=$minN
							sum laworder_index_sd if N_laworder>=$minN
							replace laworder_index_sd=(laworder_index_sd-r(min))/(r(max)-r(min)) if N_laworder>=$minN
							sum soclib_index_sd if N_soclib_index>=$minN
							replace soclib_index_sd=(soclib_index_sd-r(min))/(r(max)-r(min)) if N_soclib_index>=$minN


						************ Salience measures *************************************************
						* CHES 2010
							* Basic issues
							sum econ_salience_CHES2010 if N_econ>=$minN
							replace econ_salience_CHES2010=(econ_salience_CHES2010-r(min))/(r(max)-r(min)) if N_econ>=$minN
							sum soc_salience_CHES2010 if N_soc>=$minN
							replace soc_salience_CHES2010=(soc_salience_CHES2010-r(min))/(r(max)-r(min)) if N_soc>=$minN
							sum eu_salience if N_eu>=$minN
							replace eu_salience=(eu_salience-r(min))/(r(max)-r(min)) if N_eu>=$minN
							sum enviro_salience if N_protectenvironment>=$minN
							replace enviro_salience=(enviro_salience-r(min))/(r(max)-r(min)) if N_protectenvironment>=$minN

							* Disaggregated measures socio-cultural dimension
							sum immasylum_salience if N_immigrantsadjust>=$minN
							replace immasylum_salience=(immasylum_salience-r(min))/(r(max)-r(min)) if N_immigrantsadjust>=$minN
							sum civlib_salience if N_laworder>=$minN
							replace civlib_salience=(civlib_salience-r(min))/(r(max)-r(min)) if N_laworder>=$minN
							sum social_salience if N_soclib_index>=$minN
							replace social_salience=(social_salience-r(min))/(r(max)-r(min)) if N_soclib_index>=$minN
								
						* Manifesto data 
						* t
							* Basic issues
							sum econ_salience_Manifesto if N_econ>=$minN
							replace econ_salience_Manifesto=(econ_salience_Manifesto-r(min))/(r(max)-r(min)) if N_econ>=$minN
							sum soc_salience_Manifesto if N_soc>=$minN
							replace soc_salience_Manifesto=(soc_salience_Manifesto-r(min))/(r(max)-r(min)) if N_soc>=$minN
							sum eu_salience_Manifesto_log if N_eu>=$minN
							replace eu_salience_Manifesto_log=(eu_salience_Manifesto_log-r(min))/(r(max)-r(min)) if N_eu>=$minN
							sum enviro_salience_Manifesto_log if N_protectenvironment>=$minN
							replace enviro_salience_Manifesto_log=(enviro_salience_Manifesto_log-r(min))/(r(max)-r(min)) if N_protectenvironment>=$minN
							
							* Disaggregated measures socio-cultural dimension
							sum multicult_salience_Manifesto_log if N_immigrantsadjust>=$minN
							replace multicult_salience_Manifesto_log=(multicult_salience_Manifesto_log-r(min))/(r(max)-r(min)) if N_immigrantsadjust>=$minN
							sum ordervslib_salience_Manifesto if N_laworder>=$minN
							replace ordervslib_salience_Manifesto=(ordervslib_salience_Manifesto-r(min))/(r(max)-r(min)) if N_laworder>=$minN
							sum soclib_salience_Manif_log if N_soclib_index>=$minN
							replace soclib_salience_Manif_log=(soclib_salience_Manif_log-r(min))/(r(max)-r(min)) if N_soclib_index>=$minN

								
							
						********************************************************************************
						********************************************************************************
						************************ Heterogeneity -> salience *****************************
						********************************************************************************
						********************************************************************************
							

						***********************************************************************************************************
						*************************************** Control ***********************************************************
						***********************************************************************************************************
						* EXTREMITY of positions: absolute distance from theoretical mid point of scale as measured by CHES 2010

						* Basic issues
							gen lrecon_CHES_dev=abs(lrecon-5)
							gen galtan_CHES_dev=abs(galtan-5)
							gen eu_CHES_dev=abs(position-4)
							gen environment_dev=abs(environment-5)

						* Disaggregated measures socio-cultural dimension
							gen multiculturalism_dev=abs(multiculturalism-5)
							gen civlib_laworder_dev=abs(civlib_laworder-5)
							gen sociallifestyle_dev=abs(sociallifestyle-5)




						********************************************************************************
						************************ REGRESSION ANALYSIS ***********************************
						********************************************************************************

						* TABLE 1L: Fixed effect models
							xtreg econ_salience_Manifesto econ_sd lrecon_CHES_dev if N_econ>=$minN, fe i(elec_id)
							quietly eststo t1L_m1
							xtreg econ_salience_CHES2010 econ_sd lrecon_CHES_dev if N_econ>=$minN, fe i(elec_id) 
							quietly eststo t1L_m2
							xtreg soc_salience_Manifesto soc_sd galtan_CHES_dev if N_soc>=$minN, fe i(elec_id)
							quietly eststo t1L_m3
							xtreg soc_salience_CHES2010 soc_sd galtan_CHES_dev if N_soc>=$minN, fe i(elec_id)
							quietly eststo t1L_m4
							xtreg eu_salience_Manifesto_log eu_sd eu_CHES_dev if N_eu>=$minN, fe i(elec_id)
							quietly eststo t1L_m5
							xtreg eu_salience eu_sd eu_CHES_dev if N_eu>=$minN, fe i(elec_id) 
							quietly eststo t1L_m6
							xtreg enviro_salience_Manifesto_log disA_environ environment_dev if N_protectenvironment>=$minN, fe i(elec_id)
							quietly eststo t1L_m7
							xtreg enviro_salience disA_environ environment_dev if N_protectenvironment>=$minN, fe i(elec_id)
							quietly eststo t1L_m8
							esttab t1L_m1 t1L_m2 t1L_m3 t1L_m4 t1L_m5 t1L_m6 t1L_m7 t1L_m8 using Table1L.rtf, b(a2) se(a2) star(* 0.05 ** 0.01 *** 0.001) varwidth(20) nogaps compress ///
							mtitles("Economic" "Economic" "Socio-cultural" "Socio-cultural" "EU" "EU" "Environment" "Environment") nonumbers replace


	

	
	


******************************************************************************************
******************************** TABLE 1M ***********************************************
*** Repeat stuff using only candidates that thought they had no chance to win **********
******************************************************************************************
use "CCS_individuallevel.dta", replace
fre b16
bysort elec_id: fre b16
keep if b16==1 


						*********************** Compute the CEES VAN DER EIJK (2001) agreement measure via the agrm-ado **********
						* some preparations to get ado run
							* drop cases with partyelec_id/A1=missing
							drop if partyelec_id==.
							* shorter party-election-identifier variable name
							gen long pe_id=partyelec_id
							format pe_id  %10.00f
							* Compute standard deviations for single-items
							bysort partyelec_id: egen protectenvironment_partystd=sd(protectenvironment)
							by partyelec_id: egen immigrantsadjust_partystd=sd(immigrantsadjust)
						 
							save "CCS_in_progress.dta", replace

						  
						* protection of the environment
							 gen environ_unst=protectenvironment
							 drop if protectenvironment_partystd==.
							 bysort pe_id: agrm environ_unst, gen(A) 
							 gen A_environ=.
							 levelsof partyelec_id, local(partyelec_id)
							 foreach party_elec of local partyelec_id {
									replace A_environ=A_environ_unst_pe_id`party_elec' if A_environ_unst_pe_id`party_elec'!=.
									drop A_environ_unst_pe_id`party_elec'
							 }	
							 pwcorr A_environ protectenvironment_partystd
							 keep partyelec_id A_environ
						save "A_environ.dta", replace

						* immigrants should adjust
							 use "CCS_in_progress.dta", replace 
							 gen immi_unst=immigrantsadjust
							 drop if immigrantsadjust_partystd==.
							 bysort pe_id: agrm immi_unst, gen(A) 
							 gen A_immi=.
							 levelsof partyelec_id, local(partyelec_id)
							 foreach party_elec of local partyelec_id {
									replace A_immi=A_immi_unst_pe_id`party_elec' if A_immi_unst_pe_id`party_elec'!=.
									drop A_immi_unst_pe_id`party_elec'
							 }	
							 pwcorr A_immi immigrantsadjust_partystd
							  keep partyelec_id A_immi
						save "A_immi.dta", replace

						* merge data on agreement
						use "CCS_in_progress.dta", replace 
						merge m:m partyelec_id using "A_environ.dta", generate(A_environ_merge)
						merge m:m partyelec_id using "A_immi.dta", generate(A_immi_merge)

						* Change sign of van der Eijk's agreement measure such that it measures disgreement
						gen disA_environ=-A_environ
						gen disA_immi=-A_immi
							
							
							
						********************************************************************************
						************ Collapse the dataset to party_election structure ******************
						******************************************************************************** 
						* get mean positions, standard deviations and count of valid observations
							collapse (mean) econ_mean=econ_index soc_mean=soc_index eu_index_mean=eu_index protectenvironment_mean=protectenvironment ///
											immigrantsadjust_mean=immigrantsadjust laworder_index_mean=laworder_index soclib_index_mean=soclib_index  ///
											leftright_ego_mean=leftright_ego leftright_party_mean=leftright_party ///
											disA_environ disA_immi ///
											year countryID elec_id ///
											///
									  (sd)  econ_sd=econ_index soc_sd=soc_index eu_sd=eu_index protectenvironment_sd=protectenvironment  ///
											immigrantsadjust_sd=immigrantsadjust laworder_index_sd=laworder_index soclib_index_sd=soclib_index ///
											leftright_ego_sd=leftright_ego leftright_party_sd=leftright_party ///
											///
									(count) N_econ=econ_index N_soc=soc_index N_eu=eu_index N_protectenvironment=protectenvironment ///
											N_immigrantsadjust=immigrantsadjust N_laworder=laworder_index N_soclib_index=soclib_index ///
											N_leftright_ego=leftright_ego N_leftright_party=leftright_party ///
											, by (partyelec_id)

						* label country and election identifier in collapsed data set
							label value countryID countryID	
							label value elec_id elec_id
							decode countryID, gen(country_string)

							
							
							
						********************************************************************************
						********************* Merge with Manifesto and CHES 2010  **********************
						******************************************************************************** 

						******************* Manifesto  *********************	
						* create Manifesto party code
							do "3 create Manifesto codes.do"
							label define Manifesto_code .a "party not included"
							label value party_id_Manifesto Manifesto_code
						* merge with Manifesto
							merge m:m party_id_Manifesto year using "MPDataset_MPDS2016a_merge.dta", generate(Manifesto_merge)
						* drop cases that are Manifesto only
							drop if Manifesto_merge==2


						******************* CHES 2010  *********************	
						* create CHES2010 party code
							do "4 create CHES2010 codes.do"
							label define CHES2010_code .a "party not included" .b "country not included in CHES2010"
							label value party_id_CHES2010 CHES2010_code
						* merge with CHES 2010 party-level dataset
							merge m:m party_id_CHES2010 using "2010_CHES_dataset_means_merge.dta", generate(CHES2010_merge)
						* drop cases that are CHES2010 only
							drop if CHES2010_merge==2
						* merge with CHES 2010 collapsed expert-level dataset
							merge m:m party_id_CHES2010 using "2010_CHES_dataset_expertscollapsed_merge.dta", generate(CHES2010collexpert_merge)
						* drop cases that are CHES2010 expert-level only
							drop if CHES2010collexpert_merge==2
						* Drop all cases with missing Manifesto and CHES 2010 matches
							drop if CHES2010_merge==1 & Manifesto_merge==1	

							
							sort partyelec_id
							
							
						********************************************************************************
						********************* Create salience measures and compare them ****************
						********************************************************************************

						************ Create salience measures ******************************************
						* CHES data
							* Basic issues
							gen econ_salience_CHES2010=(spendvtax_salience+dereg_salience+redist_salience)/3
							gen soc_salience_CHES2010=(civlib_salience+social_salience+relig_salience+immigra_salience+immasylum_salience)/5     // Note: This tries to match our index; as we do not include environment, environment is not included in the salience index for example
								
							
						* Manifesto data 
						* t
							* Basic issues
							egen econ_salience_Manifesto=rowtotal(per401 per402 per403 per404 per406 per407 per409 per412 per413 per503 per504 per505 per701 per702) if per401<.
							egen soc_salience_Manifesto=rowtotal(per601-per608 per705 per706 per2022 per2023 per6072 per6081 per7051 per7052) if per601<.
							egen eu_salience_Manifesto=rowtotal(per108 per110) if per108<. 
							gen eu_salience_Manifesto_log=ln(eu_salience_Manifesto+1)
							egen enviro_salience_Manifesto=rowtotal(per501) if per501<. 
							gen enviro_salience_Manifesto_log=ln(enviro_salience_Manifesto+1)
							
							* Disaggregated measures socio-cultural dimension
							egen multicult_salience_Manifesto=rowtotal(per607 per608) if per607<. // per607: multiculturalism + ; per608: multiculturalism - (s. auch items zu national way of life)
							gen multicult_salience_Manifesto_log=ln(multicult_salience_Manifesto+1)
							egen ordervslib_salience_Manifesto=rowtotal(per201 per605) if per201<. // per 201: freedom & human rights; per201: law and order + 
															/// per 201 doesn't really fit well (see description); problem is: there is no good indicator for the other side of the scale 
							gen ordervslib_salience_Manif_log=ln(ordervslib_salience_Manifesto+1)
							egen soclib_salience_Manifesto=rowtotal(per603 per604) if per603<. // per 603/604: traditional morality: positive/negative 
							gen soclib_salience_Manif_log=ln(soclib_salience_Manifesto+1)

							
							
						********************************************************************************
						************************ Standardization to range from 0 to 1 ******************
						********************************************************************************
						* set minimum number of valide candidate positions for party to be included in analyis below (before standardization)
							global minN 10	
								
						************ Heterogeneity measures ********************************************
						* Basic issues
							sum econ_sd if N_econ>=$minN
							replace econ_sd=(econ_sd-r(min))/(r(max)-r(min)) if N_econ>=$minN
							sum soc_sd if N_soc>=$minN
							replace soc_sd=(soc_sd-r(min))/(r(max)-r(min)) if N_soc>=$minN
							sum eu_sd if N_eu>=$minN
							replace eu_sd=(eu_sd-r(min))/(r(max)-r(min)) if N_eu>=$minN
							sum disA_environ if N_protectenvironment>=$minN
							replace disA_environ=(disA_environ-r(min))/(r(max)-r(min)) if N_protectenvironment>=$minN

						* Disaggregated measures socio-cultural dimension
							sum disA_immi if N_immigrantsadjust>=$minN
							replace disA_immi=(disA_immi-r(min))/(r(max)-r(min)) if N_immigrantsadjust>=$minN
							sum laworder_index_sd if N_laworder>=$minN
							replace laworder_index_sd=(laworder_index_sd-r(min))/(r(max)-r(min)) if N_laworder>=$minN
							sum soclib_index_sd if N_soclib_index>=$minN
							replace soclib_index_sd=(soclib_index_sd-r(min))/(r(max)-r(min)) if N_soclib_index>=$minN


						************ Salience measures *************************************************
						* CHES 2010
							* Basic issues
							sum econ_salience_CHES2010 if N_econ>=$minN
							replace econ_salience_CHES2010=(econ_salience_CHES2010-r(min))/(r(max)-r(min)) if N_econ>=$minN
							sum soc_salience_CHES2010 if N_soc>=$minN
							replace soc_salience_CHES2010=(soc_salience_CHES2010-r(min))/(r(max)-r(min)) if N_soc>=$minN
							sum eu_salience if N_eu>=$minN
							replace eu_salience=(eu_salience-r(min))/(r(max)-r(min)) if N_eu>=$minN
							sum enviro_salience if N_protectenvironment>=$minN
							replace enviro_salience=(enviro_salience-r(min))/(r(max)-r(min)) if N_protectenvironment>=$minN

							* Disaggregated measures socio-cultural dimension
							sum immasylum_salience if N_immigrantsadjust>=$minN
							replace immasylum_salience=(immasylum_salience-r(min))/(r(max)-r(min)) if N_immigrantsadjust>=$minN
							sum civlib_salience if N_laworder>=$minN
							replace civlib_salience=(civlib_salience-r(min))/(r(max)-r(min)) if N_laworder>=$minN
							sum social_salience if N_soclib_index>=$minN
							replace social_salience=(social_salience-r(min))/(r(max)-r(min)) if N_soclib_index>=$minN
								
						* Manifesto data 
						* t
							* Basic issues
							sum econ_salience_Manifesto if N_econ>=$minN
							replace econ_salience_Manifesto=(econ_salience_Manifesto-r(min))/(r(max)-r(min)) if N_econ>=$minN
							sum soc_salience_Manifesto if N_soc>=$minN
							replace soc_salience_Manifesto=(soc_salience_Manifesto-r(min))/(r(max)-r(min)) if N_soc>=$minN
							sum eu_salience_Manifesto_log if N_eu>=$minN
							replace eu_salience_Manifesto_log=(eu_salience_Manifesto_log-r(min))/(r(max)-r(min)) if N_eu>=$minN
							sum enviro_salience_Manifesto_log if N_protectenvironment>=$minN
							replace enviro_salience_Manifesto_log=(enviro_salience_Manifesto_log-r(min))/(r(max)-r(min)) if N_protectenvironment>=$minN
							
							* Disaggregated measures socio-cultural dimension
							sum multicult_salience_Manifesto_log if N_immigrantsadjust>=$minN
							replace multicult_salience_Manifesto_log=(multicult_salience_Manifesto_log-r(min))/(r(max)-r(min)) if N_immigrantsadjust>=$minN
							sum ordervslib_salience_Manifesto if N_laworder>=$minN
							replace ordervslib_salience_Manifesto=(ordervslib_salience_Manifesto-r(min))/(r(max)-r(min)) if N_laworder>=$minN
							sum soclib_salience_Manif_log if N_soclib_index>=$minN
							replace soclib_salience_Manif_log=(soclib_salience_Manif_log-r(min))/(r(max)-r(min)) if N_soclib_index>=$minN

								
							
						********************************************************************************
						********************************************************************************
						************************ Heterogeneity -> salience *****************************
						********************************************************************************
						********************************************************************************
							

						***********************************************************************************************************
						*************************************** Control ***********************************************************
						***********************************************************************************************************
						* EXTREMITY of positions: absolute distance from theoretical mid point of scale as measured by CHES 2010

						* Basic issues
							gen lrecon_CHES_dev=abs(lrecon-5)
							gen galtan_CHES_dev=abs(galtan-5)
							gen eu_CHES_dev=abs(position-4)
							gen environment_dev=abs(environment-5)

						* Disaggregated measures socio-cultural dimension
							gen multiculturalism_dev=abs(multiculturalism-5)
							gen civlib_laworder_dev=abs(civlib_laworder-5)
							gen sociallifestyle_dev=abs(sociallifestyle-5)




						********************************************************************************
						************************ REGRESSION ANALYSIS ***********************************
						********************************************************************************

						* TABLE 1M: Fixed effect models
							xtreg econ_salience_Manifesto econ_sd lrecon_CHES_dev if N_econ>=$minN, fe i(elec_id)
							quietly eststo t1M_m1
							xtreg econ_salience_CHES2010 econ_sd lrecon_CHES_dev if N_econ>=$minN, fe i(elec_id) 
							quietly eststo t1M_m2
							xtreg soc_salience_Manifesto soc_sd galtan_CHES_dev if N_soc>=$minN, fe i(elec_id)
							quietly eststo t1M_m3
							xtreg soc_salience_CHES2010 soc_sd galtan_CHES_dev if N_soc>=$minN, fe i(elec_id)
							quietly eststo t1M_m4
							xtreg eu_salience_Manifesto_log eu_sd eu_CHES_dev if N_eu>=$minN, fe i(elec_id)
							quietly eststo t1M_m5
							xtreg eu_salience eu_sd eu_CHES_dev if N_eu>=$minN, fe i(elec_id) 
							quietly eststo t1M_m6
							xtreg enviro_salience_Manifesto_log disA_environ environment_dev if N_protectenvironment>=$minN, fe i(elec_id)
							quietly eststo t1M_m7
							xtreg enviro_salience disA_environ environment_dev if N_protectenvironment>=$minN, fe i(elec_id)
							quietly eststo t1M_m8
							esttab t1M_m1 t1M_m2 t1M_m3 t1M_m4 t1M_m5 t1M_m6 t1M_m7 t1M_m8 using Table1M.rtf, b(a2) se(a2) star(* 0.05 ** 0.01 *** 0.001) varwidth(20) nogaps compress ///
							mtitles("Economic" "Economic" "Socio-cultural" "Socio-cultural" "EU" "EU" "Environment" "Environment") nonumbers replace
